Skip to content

Commit 88bdfe4

Browse files
committed
fix(ci): publish image attestations
1 parent 63577bb commit 88bdfe4

4 files changed

Lines changed: 60 additions & 4 deletions

File tree

.github/workflows/docker_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ jobs:
5858
push: true
5959
tags: ${{ steps.meta.outputs.tags }}
6060
labels: ${{ steps.meta.outputs.labels }}
61-
provenance: false
62-
sbom: false
61+
provenance: mode=max
62+
sbom: true
6363
cache-from: type=gha
6464
cache-to: type=gha,mode=max
6565

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PLATFORMS ?= linux/amd64,linux/386,linux/arm/v5
55
ROOT_PASSWORD ?= root
66
PORT ?= 3306
77

8-
.PHONY: build build-all run shell structure smoke smoke-all push clean help
8+
.PHONY: build build-all run shell structure smoke smoke-all publish-check push clean help
99

1010
build: ## Build the selected platform as :latest and :$(VERSION)
1111
docker build --platform=$(PLATFORM) \
@@ -39,8 +39,12 @@ smoke-all: ## Build and smoke-test every release platform
3939
IMAGE="$$tag" PLATFORM="$$platform" SKIP_BUILD=1 ./tests/smoke.sh; \
4040
done
4141

42+
publish-check: ## Verify release attestations and Docker Hub README publishing
43+
./tests/publishing-workflow.sh
44+
4245
push: ## Build and publish the release platform index
43-
docker buildx build --push --platform=$(PLATFORMS) \
46+
docker buildx build --push --provenance=mode=max --sbom=true \
47+
--platform=$(PLATFORMS) \
4448
-t $(IMAGE):latest -t $(IMAGE):$(VERSION) .
4549

4650
clean: ## Remove local development images without prompting

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ make build-all # Build all release platforms into the Buildx cache
171171
make structure # Verify package, config, and image cleanup
172172
make smoke # Verify initialization, TCP auth, init files, and persistence
173173
make smoke-all # Attempt the lifecycle smoke test on every release platform
174+
make publish-check # Verify attestation and Docker Hub README publishing settings
174175
make run # Run the selected image locally
175176
make shell # Open Bash in the selected image
176177
```
@@ -180,6 +181,20 @@ Multi-platform targets require a Buildx builder with the corresponding QEMU
180181
handlers. `make smoke-all` fails honestly when the host emulator cannot run an
181182
architecture's MySQL bootstrap; this is a known possibility for `arm/v5`.
182183

184+
## Supply-chain metadata
185+
186+
Published images include max-level SLSA provenance and an SPDX SBOM for every
187+
platform. BuildKit attaches both attestations to the multi-platform image index,
188+
so they can be inspected from Docker Hub without pulling every image:
189+
190+
```bash
191+
docker buildx imagetools inspect oblakstudio/mysql50:latest
192+
```
193+
194+
The release workflow also publishes this README and its short description to
195+
the `oblakstudio/mysql50` Docker Hub repository after every successful image
196+
push.
197+
183198
## Releases
184199

185200
Pushes to `master` run semantic-release using Conventional Commits. A published

tests/publishing-workflow.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
WORKFLOW=".github/workflows/docker_build.yml"
5+
6+
build_inputs="$(awk '
7+
/^[[:space:]]*uses: docker\/build-push-action@v6$/ { in_step = 1; next }
8+
in_step && /^ - name:/ { exit }
9+
in_step { print }
10+
' "$WORKFLOW")"
11+
12+
grep -Eq '^[[:space:]]*push:[[:space:]]*true$' <<<"$build_inputs"
13+
grep -Eq '^[[:space:]]*platforms:[[:space:]]*linux/amd64,linux/386,linux/arm/v5$' <<<"$build_inputs"
14+
grep -Eq '^[[:space:]]*provenance:[[:space:]]*mode=max$' <<<"$build_inputs"
15+
grep -Eq '^[[:space:]]*sbom:[[:space:]]*true$' <<<"$build_inputs"
16+
17+
if grep -Eq '^[[:space:]]*(provenance|sbom):[[:space:]]*false$' "$WORKFLOW"; then
18+
echo "publishing workflow disables attestations" >&2
19+
exit 1
20+
fi
21+
22+
grep -Fq 'uses: peter-evans/dockerhub-description@v4' "$WORKFLOW"
23+
grep -Fq 'repository: ${{ env.REGISTRY_IMAGE }}' "$WORKFLOW"
24+
grep -Fq 'readme-filepath: ./README.md' "$WORKFLOW"
25+
grep -Fq 'SLSA provenance' README.md
26+
grep -Fq 'SPDX SBOM' README.md
27+
grep -Fq 'make publish-check' README.md
28+
29+
make_push="$(awk '
30+
/^push:/ { in_target = 1 }
31+
in_target && /^clean:/ { exit }
32+
in_target { print }
33+
' Makefile)"
34+
grep -Fq -- '--provenance=mode=max' <<<"$make_push"
35+
grep -Fq -- '--sbom=true' <<<"$make_push"
36+
37+
echo "publishing workflow test passed"

0 commit comments

Comments
 (0)