mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-17 10:41:49 +02:00
ci: Add a CI job that enforces image reproducibility
Add a CI job that uses the `reproduce.py` dev script to enforce image reproducibility, for every PR that we send to the repo. Fixes #1047
This commit is contained in:
parent
7a59940493
commit
279322bf43
2 changed files with 52 additions and 0 deletions
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
|
@ -471,3 +471,41 @@ jobs:
|
||||||
# file successfully.
|
# file successfully.
|
||||||
xvfb-run -s '-ac' ./dev_scripts/env.py --distro ${{ matrix.distro }} --version ${{ matrix.version }} run --dev \
|
xvfb-run -s '-ac' ./dev_scripts/env.py --distro ${{ matrix.distro }} --version ${{ matrix.version }} run --dev \
|
||||||
bash -c 'cd dangerzone; poetry run make test'
|
bash -c 'cd dangerzone; poetry run make test'
|
||||||
|
|
||||||
|
reproduce-image:
|
||||||
|
needs:
|
||||||
|
- build-container-image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install dev. dependencies
|
||||||
|
run: |-
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y git python3-poetry --no-install-recommends
|
||||||
|
poetry install --only package
|
||||||
|
|
||||||
|
- name: Verify that the Dockerfile matches the commited template and params
|
||||||
|
run: |-
|
||||||
|
poetry run jinja2 Dockerfile.in Dockerfile.env > out
|
||||||
|
diff Dockerfile out
|
||||||
|
|
||||||
|
- name: Get current date
|
||||||
|
id: date
|
||||||
|
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Restore container cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
key: v3-${{ steps.date.outputs.date }}-${{ hashFiles('Dockerfile', 'dangerzone/conversion/*.py', 'dangerzone/container/*', 'install/common/build-image.py') }}
|
||||||
|
path: |-
|
||||||
|
share/container.tar.gz
|
||||||
|
share/image-id.txt
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
|
- name: Reproduce the same container image
|
||||||
|
run: |
|
||||||
|
podman load -i share/container.tar.gz
|
||||||
|
./dev_scripts/reproduce.py --source podman://dangerzone.rocks/dangerzone:$(cat share/image-id.txt)
|
||||||
|
|
|
@ -109,3 +109,17 @@ with:
|
||||||
```
|
```
|
||||||
poetry run jinja2 Dockerfile.in Dockerfile.env > Dockerfile
|
poetry run jinja2 Dockerfile.in Dockerfile.env > Dockerfile
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Reproducing the image
|
||||||
|
|
||||||
|
For a simple way to reproduce a Dangerzone container image, either local or
|
||||||
|
pushed to a container registry, you can run the following command in a Linux
|
||||||
|
environment:
|
||||||
|
|
||||||
|
```
|
||||||
|
./dev_scripts/reproduce.py <image>
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will download the `diffoci` helper, build a container image from
|
||||||
|
the current Git commit, and ensure that the built image matches the source one,
|
||||||
|
with the exception of image names and file timestamps.
|
||||||
|
|
Loading…
Reference in a new issue