Compare commits

..

1 commit

Author SHA1 Message Date
Alex Pyrgiotis
2bd9535ae3
FIXUP: Make release image job reusable
Some checks failed
Tests / build-container-image (push) Has been cancelled
Tests / Download and cache Tesseract data (push) Has been cancelled
Tests / run tests (fedora 40) (push) Has been cancelled
Tests / run tests (fedora 41) (push) Has been cancelled
Tests / run tests (ubuntu 20.04) (push) Has been cancelled
Tests / run tests (ubuntu 22.04) (push) Has been cancelled
Tests / run tests (ubuntu 24.04) (push) Has been cancelled
Tests / run tests (ubuntu 24.10) (push) Has been cancelled
Tests / windows (push) Has been cancelled
Tests / macOS (arch64) (push) Has been cancelled
Tests / macOS (x86_64) (push) Has been cancelled
Tests / build-deb (debian bookworm) (push) Has been cancelled
Tests / build-deb (debian bullseye) (push) Has been cancelled
Tests / build-deb (debian trixie) (push) Has been cancelled
Tests / build-deb (ubuntu 20.04) (push) Has been cancelled
Tests / build-deb (ubuntu 22.04) (push) Has been cancelled
Tests / build-deb (ubuntu 24.04) (push) Has been cancelled
Tests / build-deb (ubuntu 24.10) (push) Has been cancelled
Tests / install-deb (debian bookworm) (push) Has been cancelled
Tests / install-deb (debian bullseye) (push) Has been cancelled
Tests / install-deb (debian trixie) (push) Has been cancelled
Tests / install-deb (ubuntu 20.04) (push) Has been cancelled
Tests / install-deb (ubuntu 22.04) (push) Has been cancelled
Tests / install-deb (ubuntu 24.04) (push) Has been cancelled
Tests / install-deb (ubuntu 24.10) (push) Has been cancelled
Tests / build-install-rpm (fedora 40) (push) Has been cancelled
Tests / build-install-rpm (fedora 41) (push) Has been cancelled
Tests / run tests (debian bookworm) (push) Has been cancelled
Tests / run tests (debian bullseye) (push) Has been cancelled
Tests / run tests (debian trixie) (push) Has been cancelled
2025-03-06 17:54:09 +02:00
10 changed files with 43 additions and 65 deletions

View file

@ -20,6 +20,9 @@ on:
required: true
env:
BUILDKIT_IMAGE: "docker.io/moby/buildkit:v19.0@sha256:14aa1b4dd92ea0a4cd03a54d0c6079046ea98cd0c0ae6176bdd7036ba370cbbe"
jobs:
lint:
runs-on: ubuntu-latest
@ -52,7 +55,6 @@ jobs:
- name: Compute image parameters
id: params
run: |
source Dockerfile.env
DEBIAN_ARCHIVE_DATE=$(date -u +'%Y%m%d')
SOURCE_DATE_EPOCH=$(date -u -d ${DEBIAN_ARCHIVE_DATE} +"%s")
TAG=${DEBIAN_ARCHIVE_DATE}-$(git describe --long --first-parent | tail -c +2)
@ -62,20 +64,19 @@ jobs:
echo "source_date_epoch=${SOURCE_DATE_EPOCH}" >> $GITHUB_OUTPUT
echo "tag=${DEBIAN_ARCHIVE_DATE}-${TAG}" >> $GITHUB_OUTPUT
echo "full_image_name=${FULL_IMAGE_NAME}" >> $GITHUB_OUTPUT
echo "buildkit_image=${BUILDKIT_IMAGE}" >> $GITHUB_OUTPUT
build:
name: Build ${{ matrix.platform.name }} image
runs-on: ${{ matrix.platform.runs-on }}
runs-on: ubuntu-24.04${{ matrix.platform.suffix }}
needs:
- prepare
strategy:
fail-fast: false
matrix:
platform:
- runs-on: "ubuntu-24.04"
- suffix: ""
name: "linux/amd64"
- runs-on: "ubuntu-24.04-arm"
- suffix: "-arm"
name: "linux/arm64"
steps:
- uses: actions/checkout@v4
@ -97,7 +98,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: image=${{ needs.prepare.outputs.buildkit_image }}
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
- name: Build and push by digest
id: build
@ -109,7 +110,7 @@ jobs:
DEBIAN_ARCHIVE_DATE=${{ needs.prepare.outputs.debian_archive_date }}
SOURCE_DATE_EPOCH=${{ needs.prepare.outputs.source_date_epoch }}
provenance: false
outputs: type=image,"name=${{ inputs.registry }}/${{ inputs.image_name }}",push-by-digest=true,push=true,rewrite-timestamp=true,name-canonical=true
outputs: type=image,"name=${{ inputs.registry }}/${{ needs.image_name }}",push-by-digest=true,push=true,rewrite-timestamp=true,name-canonical=true
cache-from: type=gha
cache-to: type=gha,mode=max
@ -131,7 +132,7 @@ jobs:
merge:
runs-on: ubuntu-latest
needs:
- prepare # implied by build, but required here to access image params
- prepare
- build
outputs:
digest_root: ${{ steps.image.outputs.digest_root }}
@ -192,11 +193,11 @@ jobs:
# the container registry.
provenance:
needs:
- prepare # implied by merge, but required here to access image params
- prepare
- merge
strategy:
matrix:
manifest_type:
digest:
- root
- amd64
- arm64
@ -216,16 +217,16 @@ jobs:
check-reproducibility:
if: ${{ inputs.reproduce }}
needs:
- prepare # implied by merge, but required here to access image params
- prepare
- merge
runs-on: ${{ matrix.platform.runs-on }}
runs-on: ubuntu-24.04${{ matrix.platform.suffix }}
strategy:
fail-fast: false
matrix:
platform:
- runs-on: "ubuntu-24.04"
- suffix: ""
name: "amd64"
- runs-on: "ubuntu-24.04-arm"
- suffix: "-arm"
name: "arm64"
steps:
- uses: actions/checkout@v4

View file

@ -19,4 +19,4 @@ jobs:
image_name: dangerzone/dangerzone
reproduce: true
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}
registry_token : ${{ github.token }}

View file

@ -182,11 +182,8 @@ RUN mkdir -p \
/new_root/tmp \
/new_root/home/dangerzone/dangerzone-image/rootfs
# Copy the /etc and /var directories under the new root directory. Also,
# copy /etc/, /opt, and /usr to the Dangerzone image rootfs.
#
# XXX: We also have to remove the resolv.conf file, in order to not leak any DNS
# servers added there during image build time.
# XXX: Remove /etc/resolv.conf, so that the network configuration of the host
# does not leak.
RUN cp -r /etc /var /new_root/ \
&& rm /new_root/etc/resolv.conf
RUN cp -r /etc /opt /usr /new_root/home/dangerzone/dangerzone-image/rootfs \

View file

@ -7,7 +7,3 @@ GVISOR_ARCHIVE_DATE=20250217
# Can be bumped to the latest version and checksum from https://github.com/ebandal/H2Orestart/releases
H2ORESTART_CHECKSUM=452331f8603ef456264bd72db6fa8a11ca72b392019a8135c0b2f3095037d7b1
H2ORESTART_VERSION=v0.7.1
# Buildkit image (taken from freedomofpress/repro-build)
BUILDKIT_IMAGE="docker.io/moby/buildkit:v19.0@sha256:14aa1b4dd92ea0a4cd03a54d0c6079046ea98cd0c0ae6176bdd7036ba370cbbe"
BUILDKIT_IMAGE_ROOTLESS="docker.io/moby/buildkit:v0.19.0-rootless@sha256:e901cffdad753892a7c3afb8b9972549fca02c73888cf340c91ed801fdd96d71"

View file

@ -182,11 +182,8 @@ RUN mkdir -p \
/new_root/tmp \
/new_root/home/dangerzone/dangerzone-image/rootfs
# Copy the /etc and /var directories under the new root directory. Also,
# copy /etc/, /opt, and /usr to the Dangerzone image rootfs.
#
# XXX: We also have to remove the resolv.conf file, in order to not leak any DNS
# servers added there during image build time.
# XXX: Remove /etc/resolv.conf, so that the network configuration of the host
# does not leak.
RUN cp -r /etc /var /new_root/ \
&& rm /new_root/etc/resolv.conf
RUN cp -r /etc /opt /usr /new_root/home/dangerzone/dangerzone-image/rootfs \

View file

@ -128,9 +128,11 @@ def get_expected_tag() -> str:
def load_image_tarball() -> None:
log.info("Installing Dangerzone container image...")
tarball_path = get_resource_path("container.tar")
with open(tarball_path) as f:
try:
res = subprocess.run(
[get_runtime(), "load", "-i", tarball_path],
[get_runtime(), "load"],
stdin=f,
startupinfo=get_subprocess_startupinfo(),
capture_output=True,
check=True,

View file

@ -130,7 +130,7 @@ def is_qubes_native_conversion() -> bool:
# This disambiguates if it is running a Qubes targetted build or not
# (Qubes-specific builds don't ship the container image)
container_image_path = get_resource_path("container.tar")
return not os.path.exists(container_image_path)
compressed_container_path = get_resource_path("container.tar")
return not os.path.exists(compressed_container_path)
else:
return False

View file

@ -220,22 +220,7 @@ def oci_normalize_path(path):
def oci_get_file_from_tarball(tar: tarfile.TarFile, path: str) -> dict:
"""Get file from an OCI tarball.
If the filename cannot be found, search again by prefixing it with "./", since we
have encountered path names in OCI tarballs prefixed with "./".
"""
try:
return tar.extractfile(path).read().decode()
except KeyError:
if not path.startswith("./") and not path.startswith("/"):
path = "./" + path
try:
return tar.extractfile(path).read().decode()
except KeyError:
# Do not raise here, so that we can raise the original exception below.
pass
raise
return
def oci_parse_manifest(tar: tarfile.TarFile, path: str, platform: dict | None) -> dict:
@ -246,7 +231,7 @@ def oci_parse_manifest(tar: tarfile.TarFile, path: str, platform: dict | None) -
carry it from the previous manifest and include in the info here.
"""
path = oci_normalize_path(path)
contents = oci_get_file_from_tarball(tar, path)
contents = tar.extractfile(path).read().decode()
digest = "sha256:" + hashlib.sha256(contents.encode()).hexdigest()
contents_dict = json.loads(contents)
media_type = get_key(contents_dict, "mediaType")

View file

@ -102,7 +102,7 @@ def main():
f"Check that the reproduced image has the expected digest: {args.digest}"
)
run(
"./dev_scripts/repro-build.py",
"./dev_scripts/repro-build",
"analyze",
"--show-contents",
"share/container.tar",

View file

@ -122,7 +122,7 @@ def main():
subprocess.run(
[
"./dev_scripts/repro-build.py",
"./dev_scripts/repro-build",
"build",
"--runtime",
args.runtime,