Skip to content

Commit 7fea392

Browse files
committedNov 16, 2024
Check container reproducibility with diffoci
Create a Makefile target to test the reproducibility of the project container using diffoci[1]. This tool provides a way to test for reproducibility of OCI containers by virtue of being able to display the diff between two versions of a container. It also allows for omitting some uninteresting diffs such as timestamps (with the `--semantic` flag). This is an early prototype as the setup currently introduces the Go programming as a dependency and has non-optimal or missing version pinning. -- 1. https://github.com/reproducible-containers/diffoci
1 parent 6c90d5f commit 7fea392

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed
 

‎.github/workflows/check.yml

+14
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ jobs:
8585
- name: Lint YAML
8686
if: ${{ failure() || success() }}
8787
run: make lint-yml
88+
reproducible-container:
89+
name: Reproducible container
90+
runs-on: ubuntu-22.04
91+
needs:
92+
- build
93+
steps:
94+
- name: Checkout repository
95+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
96+
- name: Install Go
97+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
98+
with:
99+
go-version: 1.23
100+
- name: Check reproducibility
101+
run: make reproducible-build
88102
test:
89103
name: Test with ${{ matrix.engine }}
90104
runs-on: ubuntu-24.04

‎Makefile

+13-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ lint-yml: $(TOOLING) ## Lint .yml files
121121
-c .yamllint.yml \
122122
.
123123

124+
.PHONY: reproducible-build
125+
reproducible-build: build ## Check if the container is reproducible
126+
@TAG=a make build
127+
@TAG=b make build
128+
@go run github.com/reproducible-containers/diffoci/cmd/diffoci@v0.1.5 diff \
129+
--semantic \
130+
docker://$(IMAGE_NAME):a \
131+
docker://$(IMAGE_NAME):b
132+
@$(ENGINE) rmi --force \
133+
$(IMAGE_NAME):a \
134+
$(IMAGE_NAME):b
135+
124136
.PHONY: sbom
125137
sbom: $(SBOM_SPDX_FILE) $(SBOM_SYFT_FILE) ## Generate a Software Bill Of Materials (SBOM)
126138

@@ -132,7 +144,7 @@ test: build $(NODE_MODULES) ## Run the tests
132144
--experimental-test-snapshots \
133145
'tests/*.test.js'
134146

135-
update-test-snapshots: build $(NODE_MODULES) ## Update the test snapsthos
147+
update-test-snapshots: build $(NODE_MODULES) ## Update the test snapshots
136148
@CONTAINER_ENGINE=$(ENGINE) \
137149
node --test \
138150
--test-timeout=20000 \

0 commit comments

Comments
 (0)