Skip to content

Commit 501fea7

Browse files
authored
feat(release): build the manager image from the cryptos-web tag of the same name (#211)
Refs #210 Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com> Co-authored-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
1 parent 25f7d3a commit 501fea7

4 files changed

Lines changed: 37 additions & 17 deletions

File tree

‎.github/workflows/ci-image.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5858
with:
5959
repository: CryptOS-PKI/cryptos-web
60-
ref: ${{ vars.WEB_RELEASE_REF || 'main' }}
60+
ref: main
6161
path: web
6262

6363
- name: 🛠️ Set up Docker Buildx

‎.github/workflows/job-release-image.yaml‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: "🚀 Release image"
22

3-
# A v* tag publishes the manager image and its Helm chart: build from the
4-
# pinned web ref, prove the image with the read-only health check, then push
3+
# A v* tag publishes the manager image and its Helm chart: build with the
4+
# web console from cryptos-web's tag of the same name (the two repos are
5+
# versioned in lockstep), prove the image with the read-only health check, then push
56
# only if that check passes. `latest` moves only on a stable tag (no "-"
67
# prerelease suffix); an rc tag publishes its own tag but never latest. The
78
# chart version always matches the tag (without its leading "v"). The node
@@ -29,29 +30,32 @@ jobs:
2930
NET: fleet-release-check
3031
REGISTRY_IMAGE: ghcr.io/cryptos-pki/cryptos-manager
3132
steps:
32-
# A tagged image has to be rebuildable from the tag. Falling back to
33-
# web's main would embed whatever web happened to be at build time, so
34-
# the release refuses to build until the web ref is pinned.
35-
- name: Require a pinned web ref
33+
# cryptos-manager and cryptos-web are versioned in lockstep: the image
34+
# for vX.Y.Z embeds the web console from cryptos-web's vX.Y.Z. That
35+
# release has to be published first; the releases/tags endpoint only
36+
# returns published releases, so a draft or a missing tag fails here.
37+
- name: Require the matching cryptos-web release
3638
env:
37-
WEB_RELEASE_REF: ${{ vars.WEB_RELEASE_REF }}
39+
GH_TOKEN: ${{ github.token }}
40+
TAG: ${{ github.ref_name }}
3841
run: |
39-
if [ -z "$WEB_RELEASE_REF" ]; then
40-
echo "::error::Set the WEB_RELEASE_REF repository variable to a web tag or commit SHA before cutting a release."
42+
set -euo pipefail
43+
if ! draft="$(gh api "repos/CryptOS-PKI/cryptos-web/releases/tags/$TAG" -q .draft 2>/dev/null)" || [ "$draft" != "false" ]; then
44+
echo "::error::cryptos-web has no published release at $TAG. The two repos are versioned in lockstep: publish cryptos-web's $TAG draft first (with the same version), then re-run this workflow."
4145
exit 1
4246
fi
43-
echo "web ref: $WEB_RELEASE_REF"
47+
echo "web release: $TAG"
4448
4549
- name: Checkout manager
4650
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4751
with:
4852
path: manager
4953

50-
- name: Checkout web (pinned)
54+
- name: Checkout web (same tag)
5155
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5256
with:
5357
repository: CryptOS-PKI/cryptos-web
54-
ref: ${{ vars.WEB_RELEASE_REF }}
58+
ref: refs/tags/${{ github.ref_name }}
5559
path: web
5660

5761
# Resolve what is actually being built, so the image can report it (#81).

‎.github/workflows/release-drafter.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ name: Release Drafter
1212
on:
1313
push:
1414
branches: [main]
15+
# cryptos-manager and cryptos-web are versioned in lockstep, but each repo
16+
# resolves its next version from its own labels, so the two drafts can come
17+
# out different. Dispatching with a version (no leading "v", e.g.
18+
# 0.1.0-rc.2) sets this repo's draft to it. Both drafts must carry the same
19+
# version before either is published; the merge freeze keeps a later push
20+
# from resolving it again.
1521
workflow_dispatch:
22+
inputs:
23+
version:
24+
description: "Draft this version instead of the one resolved from labels (no leading v, e.g. 0.1.0-rc.2)"
25+
required: false
26+
default: ""
1627

1728
permissions:
1829
contents: read
@@ -44,3 +55,4 @@ jobs:
4455
first-version: 0.1.0
4556
prerelease: true
4657
prerelease-identifier: rc
58+
version: ${{ inputs.version }}

‎README.md‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,17 @@ After a stacked pull request is retargeted onto `main`, CI starts on its next pu
348348

349349
## 📦 Releasing
350350

351-
Nothing tags automatically. On push to `main`, release-drafter categorises the merged conventional-commit PRs into the draft release notes. The maintainer then publishes the GitHub Release by hand, which creates the `vX.Y.Z` tag. That tag triggers `job-release-image.yaml`, which builds the container image from the pinned web ref with BuildKit, runs it read-only against the health check, and — only once that passes — pushes `ghcr.io/cryptos-pki/cryptos-manager:vX.Y.Z` and packages and pushes the chart to `oci://ghcr.io/cryptos-pki/charts/fleet-manager` at the same version. `latest` moves only on a stable tag (no `-` prerelease suffix); an rc publishes its own tag but never `latest`. Neither push carries any provenance, SBOM or other attestation. The node ISO ships from [`cryptos-appliance`](https://github.com/CryptOS-PKI/cryptos-appliance), source only. Adopters who want something other than the published image or chart build and push their own from the tagged source (see [*Building the image yourself*](#building-the-image-yourself)). (The repo's own release/governance tooling — release-drafter, golic — is the maintainer's; adopters don't need it.)
351+
Nothing tags automatically. On push to `main`, release-drafter categorises the merged conventional-commit PRs into the draft release notes. The maintainer then publishes the GitHub Release by hand, which creates the `vX.Y.Z` tag. That tag triggers `job-release-image.yaml`, which builds the container image with BuildKit, with the web console from `cryptos-web`'s tag of the same name, runs it read-only against the health check, and — only once that passes — pushes `ghcr.io/cryptos-pki/cryptos-manager:vX.Y.Z` and packages and pushes the chart to `oci://ghcr.io/cryptos-pki/charts/fleet-manager` at the same version. `latest` moves only on a stable tag (no `-` prerelease suffix); an rc publishes its own tag but never `latest`. Neither push carries any provenance, SBOM or other attestation. The node ISO ships from [`cryptos-appliance`](https://github.com/CryptOS-PKI/cryptos-appliance), source only. Adopters who want something other than the published image or chart build and push their own from the tagged source (see [*Building the image yourself*](#building-the-image-yourself)). (The repo's own release/governance tooling — release-drafter, golic — is the maintainer's; adopters don't need it.)
352352

353353
The release image is meant to be rebuildable from its tag. Every base image in the
354354
`Dockerfile` is pinned by digest, the build date is the tagged commit's time rather than
355-
the clock, and the release refuses to build until the `WEB_RELEASE_REF` repository
356-
variable pins the `web` checkout to a tag or commit (falling back to `web`'s `main` would
357-
embed whatever was there that day). A pull request that touches the image runs
355+
the clock, and the `web` checkout is `cryptos-web`'s tag of the same name. The two repos are
356+
versioned in lockstep: `vX.Y.Z` of the manager embeds `vX.Y.Z` of the web console, so
357+
`cryptos-web`'s release is published first, and the image workflow fails with a clear error
358+
when `cryptos-web` has no published release at that tag. Each repo's Release Drafter resolves
359+
its next version from its own labels, so the two drafts can differ; before either is
360+
published both must carry the same version. Dispatch the Release Drafter workflow with a
361+
`version` input (for example `0.1.0-rc.2`) to set one to match. A pull request that touches the image runs
358362
`.github/workflows/ci-image.yaml`, which builds it without pushing, runs it read-only with
359363
every capability dropped against a Postgres container, and checks that it turns healthy,
360364
that the node-creds volume is owned by 65532, and that `/healthz` answers 503 once the

0 commit comments

Comments
 (0)