Repository navigation
ci: fix image tags and notify Pubgrade on release - #68
Conversation
Add ci.yml as in the org's other repositories (PR title, lint, test, smoke test, image scan, gate). The scan only reports until the dependency update. The base image of the Dockerfile no longer exists; build from source on Temurin 8 instead (not Alpine: TLS handshakes fail there on Java 8). Add a .dockerignore. Remove the old workflows, which can't run any more and would publish over the tag of the last release on every push to master, and Travis. Closes #59 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move to the last releases of the Spring Boot 2.7 line, and pin the transitive dependencies the scan flags. spring-security-oauth2 2.5 makes its exception translator generic, which the entry point adapts to. What is fixed only in Spring Boot 3 goes to .trivyignore.yaml, each entry with its reason and expiry date. The scan in CI now fails on fixable critical and high findings. Closes #60 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add release.yml as in the org's other repositories: a tag vX.Y.Z publishes X.Y.Z (and latest for the highest release) to the same image name, by digest, after checks of the tag and of CI, and a scan. Other version tags stay untouched. After that, one POST to Pubgrade, skipped unless its settings are set. It needs Pubgrade's publish mode (elixir-cloud-aai/Pubgrade#33). Closes #61 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR consolidates CI and release automation around pinned, permission-minimized GitHub Actions: every change is tested and scanned, releases are validated and published by a scanned digest with controlled stable/pre-release tags, and optionally notify Pubgrade after publication. It also makes container builds self-contained and reproducible while refreshing dependencies and documenting the new process. Sequence diagram for the validated image release and Pubgrade notificationsequenceDiagram
participant Git as GitHub tag push
participant Prepare as prepare
participant Push as push
participant Scan as scan
participant Publish as publish
participant Registry as Docker Hub
participant Pubgrade as Pubgrade
Git->>Prepare: Check release tag and commit
Prepare->>Prepare: Check that CI passed for the release commit
Prepare->>Push: version and sha
Push->>Registry: Build and push image by digest
Push-->>Scan: digest
Scan->>Registry: Scan image digest
Scan-->>Publish: Scan passed
Publish->>Registry: Attest build provenance
Publish->>Registry: Sign image
Publish->>Registry: Tag image
Publish-->>Pubgrade: POST /repositories/{id}/builds
Flow diagram for stable and pre-release image tagsflowchart TD
Tag["Signed annotated vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN, or vX.Y.ZrcN"] --> Validate["Validate tag, pom.xml, master ancestry, and CI"]
Validate --> Digest["Push one image digest and scan it"]
Digest --> Stable{"Stable tag is highest release on master?"}
Stable -->|Yes| StableTags["Publish X.Y.Z and latest"]
Stable -->|No| VersionTag["Publish X.Y.Z only"]
Digest --> Pre["Pre-release tag"]
Pre --> PreTag["Publish X.Y.ZaN, X.Y.ZbN, or X.Y.ZrcN only"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #68 +/- ##
=======================================
Coverage 55.90% 55.90%
=======================================
Files 64 64
Lines 2150 2150
Branches 233 233
=======================================
Hits 1202 1202
Misses 807 807
Partials 141 141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="256" />
<code_context>
+ for tag in "${tags[@]}"; do
+ docker buildx imagetools create --tag "${tag}" "${IMAGE_NAME}@${DIGEST}"
+ actual="$(docker buildx imagetools inspect "${tag}" \
+ --format '{{ json .Manifest }}' | jq -r .digest)"
+ if [[ "${actual}" != "${DIGEST}" ]]; then
+ echo "::error::${tag} points to ${actual}, expected ${DIGEST}"
</code_context>
<issue_to_address>
**Every publish check fails**
When a release image is tagged, `imagetools inspect --format '{{ json .Manifest }}'` returns a manifest without a `digest` field, so `jq -r .digest` returns `null` and the comparison fails after the image tags are pushed. The publish job fails and Pubgrade is not notified.
Read the inspected image's digest from a field or command that actually returns it, then compare that value with `${DIGEST}`.
Also at `.github/workflows/release.yml:257`.
</issue_to_address>
### Comment 2
<location path=".github/workflows/release.yml" line_range="32-33" />
<code_context>
+# edits that leave the title unchanged (e.g., of the description, also by bots)
+# share a group of their own, so that they cancel each other but not the run
+# for the pull request's commit
+concurrency:
+ group: >-
+ ${{ github.workflow }}-${{
</code_context>
<issue_to_address>
**Latest points to an older image**
When stable releases of different versions overlap and the older run selects itself as highest before the newer tag appears, the older run uses its stale tag snapshot to decide to update `latest`, then pushes its digest after the newer release has moved `latest` forward. Consumers pulling `latest` are sent back to the older image.
Ensure a release can update `latest` only when its version is still the highest at the time the tag is written.
Also at `.github/workflows/release.yml:245-254`.
</issue_to_address>
### Comment 3
<location path=".github/workflows/release.yml" line_range="254" />
<code_context>
+ tags+=("${IMAGE_NAME}:latest")
+ fi
+ for tag in "${tags[@]}"; do
+ docker buildx imagetools create --tag "${tag}" "${IMAGE_NAME}@${DIGEST}"
+ actual="$(docker buildx imagetools inspect "${tag}" \
+ --format '{{ json .Manifest }}' | jq -r .digest)"
</code_context>
<issue_to_address>
**Reruns replace published version images**
When an operator reruns all jobs for an already-published release, `imagetools create` retargets the existing `X.Y.Z` tag to the newly built digest, so clients pulling that version can receive a different image even though the release version is unchanged.
Refuse to retarget an existing version tag unless its digest already matches, or require an explicit version-bump process to publish a different digest.
</issue_to_address>
### Comment 4
<location path=".github/workflows/release.yml" line_range="304-306" />
<code_context>
+ # HTTPS only (also for redirects, which aren't followed anyway); the
+ # token goes in through stdin, not the command line
+ curl --proto '=https' --silent --show-error --fail-with-body --max-time 300 \
+ --request POST "${PUBGRADE_URL%/}/repositories/${PUBGRADE_REPOSITORY_ID}/builds" \
+ --header 'Content-Type: application/json' \
+ --data "${body}" \
+ --config - <<< "header = \"X-Project-Access-Token: ${PUBGRADE_TOKEN}\""
</code_context>
<issue_to_address>
**Pubgrade receives duplicate notifications**
When pubgrade accepts a request but the workflow does not record success, or an operator reruns the failed notification job, the notification job sends the same build-creation POST again; if Pubgrade records each POST as a build, subscribed deployments receive duplicate notifications for the release.
Make build-creation requests idempotent so retries and reruns do not create duplicate notifications.
</issue_to_address>Linked issues
#61 ci: fix image tags and notify Pubgrade on release · 3 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Publish the image for vX.Y.Z as X.Y.Z and latest only if it is the highest release, after checking the tag, CI, and image scan. | ✅ Met | The release workflow checks the version, signature, master ancestry, and successful CI run; it builds and scans the image by digest before tagging it. |
| 2 | After the push, POST to Pubgrade on a tag, using the configured URL, repository, and token; skip the call when settings are unset. | ✅ Met | The notify job runs after publishing, skips when all three settings are unset, rejects partial configuration, and sends one HTTPS POST. |
| 3 | Document how to release and which settings the workflow uses. | ✅ Met | The README describes release tags, image tags, release checks and approval, and the Pubgrade environment settings. |
Sourcery assessment
Needs a human reviewer. 4 findings to address first, the security scan did not finish, and a mistake in the release workflow could publish an incorrect image under a version tag or latest, then send a Pubgrade notification that prompts subscribed deployments to act on it. Reverting the workflow cannot retract images already pulled or undo notifications already sent.
Blocking findings: .github/workflows/release.yml:256, .github/workflows/release.yml:33, .github/workflows/release.yml:254, .github/workflows/release.yml:306
A re-run of all jobs builds a new digest: refuse it if X.Y.Z points to another one. Publish one release at a time, so that latest is decided and written in one go. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Align CI with the branching model of the org's other repositories (`dev` + `main`): run on pull requests and pushes to `dev`; on pushes, push the image by digest in the environment `dev-images`, scan exactly that digest, then attest, sign and tag it `dev` and `sha-<commit>`, as cloud-registry does. Add the weekly scan of `latest` (`scan.yml`), let Dependabot target `dev`, and fail pushes on Codecov upload errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Publish only on pushes to this repository, or to forks that set `DOCKERHUB_ORG` (`PUBLISH`, as in proTES and foca): other runs scan a local build, upload nothing to code scanning and don't fail on Codecov upload errors, and the gate allows the skipped publishing jobs. Name the environment and secrets publishing needs in the README, and fix comments from the review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # .github/workflows/ci.yml
# Conflicts: # .github/workflows/ci.yml # .trivyignore.yaml
The branching model is now `dev` + `main`: release commits must be on `main`, `latest` goes by the tags on `main`, and CI must have passed for the push of the release commit to `dev`. As in cloud-registry, the version in `CITATION.cff` must be the release version, as Zenodo archives the tagged metadata. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse a version that is already published before attesting and signing the new digest, and fail on registry errors instead of taking them for a missing tag. Name the tag rulesets that protect the release and Pubgrade secrets, and clarify the version rules for pre-releases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restore the files of #67 to their state on `dev`, so that this pull request no longer depends on #67, which waits for a decision. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Closes #61. Part of #72. Based on
dev(#64 merged); independent of #67.release.yml/Release, as in the organisation's other repositories: a tagvX.Y.ZpublishesX.Y.Zto the same image name,latestonly for the highest release onmain, and never touches other versions. By digest, after checks of the tag (signed, annotated, onmain), of the versions inpom.xmlandCITATION.cff, and of CI for the commit's push todev, and a scan of the digest.vX.Y.ZrcN, alsoaN,bN) publish their own tag only, for rehearsals;CITATION.cffthen needs the full version (e.g.1.2.0rc1).POST /repositories/{id}/buildsto Pubgrade, in the environmentpubgrade. It's skipped whenPUBGRADE_URL,PUBGRADE_REPOSITORY_IDandPUBGRADE_TOKENare unset, and fails if only some are set. HTTPS only.devyet. The body uses the existing schema (images[].name,head_commit.tag), so check it against Switch to GitHub Actions instead of Travis CI #33 when that merges, and leave the settings unset until then.Needs before the first tag
pubgradeshould allowv*tags only (no reviewer needed; the tag rulesets let only admins createv*tags). Thereleaseenvironment and the tag rulesets are in place.CITATION.cff(chore: add CODEOWNERS and CITATION.cff #75) with the release version, set in the release-prep PR (build: prepare the 1.2.0 release #70).Verified
yq); actionlint runs in CI (Lint).pom.xml, theCITATION.cffversion regex (1.2.0rc1), highest-tag selection, and thatcurlrefuseshttp://.v1.2.0rc1) covers it, before the real tag.Declined review findings
v1.0,v1.1) in thelatestdecision:v1.2.0is above them.publish(one pending job per concurrency group): documented in the header (re-run failed jobs); same in the other repositories.ci.ymlandrelease.yml(login, attest, sign, tag loop): the org's pattern; no shared script yet.🤖 Generated with Claude Code