Repository navigation
Workflow container release
What it does. Builds a container image, tests it, scans it with Trivy, and only then publishes it multi-arch to GHCR (and Docker Hub, if asked), signs it with cosign, attaches a syft SPDX SBOM as an attestation, and records SLSA build provenance. It builds whatever the Dockerfile builds; the name no longer says Python. On a pull request it builds, tests and scans and stops.
Why it exists. The same release was hand-written in nine repositories. The properties that came out of it: nothing is published, signed or attested from a pull request; a publishing build never reads the Actions cache; and each platform is built and tested natively, so the arm64 image the test runs against is the arm64 image that ships. See Releases and supply chain.
| Job | Holds | Notes |
|---|---|---|
plan |
contents: read |
Works out the per-platform build matrix and the lower-cased GHCR image name |
dockerfile-lint |
contents: read |
hadolint, pinned version and per-architecture sha256, cached and hash-checked on disk |
build (per platform, publishing runs only) |
contents: read, packages: write, security-events: write
|
Builds once on a native runner (ubuntu-24.04-arm for arm64), pushes under a temporary <sha>-<run id>-<attempt>-<arch> tag, pulls it back by digest and runs the non-root check, the optional read-only probe and the Trivy scan (SARIF) on that image; records its digest |
build-local (per platform, runs that do not publish) |
contents: read, security-events: write
|
The same checks on one local build. No package write, no login, no push |
merge |
contents: read, packages: write, id-token: write, attestations: write
|
Stages an index per registry from the recorded digests (GHCR, and Docker Hub when enabled) under a tag of this run, checks each one's digest and contents and that the digests agree, then signs, attaches the SBOM, records provenance and verifies, and only then writes the real tags (sha- tags first, latest last). Only after a push, never on a pull request |
The build job pushes only its own temporary platform tags; the signing identity exists only in merge.
Publishing is an allow-list. With push: true the run publishes only for a push of a vMAJOR.MINOR.PATCH tag (SemVer 2.0.0 pre-release and build parts allowed). Any other run builds and scans, and says so in a warning annotation and the step summary. allowed-publish-events (default push; * or comma-separated lowercase names, no spaces) and require-tag-ref (default true) widen it.
BREAKING CHANGE. Publishing is an allow-list: only a push of a vMAJOR.MINOR.PATCH tag publishes unless the caller sets allowed-publish-events and require-tag-ref: false. A refused push: true run builds and scans, and prints a publish skipped warning annotation and a job summary with the reason and the inputs to set. Also in this release: the build is split into build (publishing) and build-local; each registry gets its own index built from verified digests; platforms is validated as written and a repeated platform is refused; the tag check is SemVer 2.0.0; allowed-publish-events is validated. penguin-overlord and solarstorm_scout (main, schedule and manual publishers) add allowed-publish-events: push,schedule,workflow_dispatch and require-tag-ref: false; hypeman calls python-package-release.yml instead and follows that workflow's publish inputs.
Docker Hub. The per-registry index relies on buildx copying GHCR sources into Docker Hub. That is observed behavior of the previous version in production: ChiefGyk3D/Stream-Daemon run 41512180852 (2026-11-02, success) logged copying ... from ghcr.io/... to docker.io/.... Docker's documentation says sources must already exist in the destination registry; if buildx enforced that, the Docker Hub step would fail before signing.
Migrating. A caller that published from main, a schedule or a manual run (for example penguin-overlord and solarstorm_scout, which pass push: ${{ github.event_name != 'pull_request' }}) sets allowed-publish-events: push,schedule,workflow_dispatch and require-tag-ref: false; a caller that releases only from v*.*.* tags changes nothing.
One build per platform. A publishing leg builds once, pushes it, pulls it back by digest and runs the checks and the Trivy scan on that image; a non-publishing leg builds once, locally. merge stages the index under stage-<sha>-<run id>-<attempt> and verifies its digest and contents. No release tag is written there.
Order of a publish (issue #286). Stage the index in each registry, sign it, attest the SBOM, record provenance and verify the signature and the SBOM attestation of that digest with the pinned identity; only then does the tag step write the release tags. If any earlier step fails, no release tag moves.
The tag step is bounded, not atomic. A registry cannot write several tags in one step, so the step cannot promise that all tags move or none. Before writing anything it checks that the staged index reads back at its digest in each registry and records the digest every release tag holds now (a not-found reply means the tag is new; any other read failure stops the step with nothing moved). It writes one tag at a time, immutable sha- tags first and latest last, each from its own registry, reads each back, and reads every tag again after the last write. Every registry call is retried up to 4 attempts in all (5, 10 and 20 seconds), only for HTTP 408, 425, 429, any 5xx or a timeout or reset; a write that returns an error is judged by reading the tag back. Every digest a tag moves to is already signed, attested and verified.
On a failure the restore is best effort and never overwrites another writer. A tag is written back to its previous digest only while it still holds the digest this run wrote; a tag that holds any other digest was changed by someone else and is left alone, and the step fails with a "rollback failed" error naming the tag, the digest it holds, the digest this run promoted and the recorded previous digest. A tag already back on its previous digest needs no write. A restore needs the previous manifest to still exist, and the previous digest is whatever the tag held: this workflow does not verify it again. A tag that did not exist before cannot be deleted, so it may remain on the new digest; the step names it. If a restore is refused or fails, the step fails and names every tag and digest left behind. The step does not stop another writer with registry access. A registry has no compare-and-swap on a tag, so the read before a restore write cannot be made atomic with it; this window cannot be closed, only narrowed by the concurrency group and an immediate re-read.
One publish per GHCR image, and release order. Runs that publish the same GHCR image run one at a time whether or not Docker Hub is on, whatever their ref, and a running one is never cancelled. The key is the GHCR image, never the ref, the commit or other event data; Docker Hub is not in it, so callers with different GHCR images that share a Hub repository are not queued behind each other. The image name and dockerhub-repository take only letters, digits, ., _, - and / on one line. The ref is re-checked before each moving tag and once after the last; a run that is no longer the newest is rolled back and fails. GitHub keeps one pending run per group, so a pending run is replaced by a newer pending run for the same image; re-run the replaced one. The tag step also checks order. On a branch ref a run whose commit is no longer the head publishes only its sha- tags. On a vMAJOR.MINOR.PATCH tag ref it lists the repository's v* tags through the API (contents: read) and compares SemVer 2.0.0 precedence (a stable release against stable releases only): if a newer release exists it publishes only its version tag and the sha- tags and leaves latest, the major and minor tags alone, with a notice. A tag ref that is not a SemVer release has no order, so it publishes only its own name and the sha- tags. If the head or the tag list cannot be read, nothing moves.
Rekor conflicts and retries. A Rekor 409 (an equivalent entry already exists) is success only when cosign verify (verify-attestation for the SBOM) of that digest passes with signer-identity-regexp, the GitHub OIDC issuer, the calling repository and the commit of the run. A transient error (HTTP 408, 425, 429 and every 5xx, a timeout, a reset connection) is retried 4 times in all, waiting 5, 10 and 20 seconds. Any other error fails at once.
Signing is required to publish. A run that would publish with sign, sbom or provenance off fails in the plan job, and the tag step refuses too, unless allow-unsigned-publish: true. A run that does not publish is unaffected. signer-identity-regexp is validated in the plan job and again in merge.
on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]
schedule:
- cron: '0 5 * * 1' # weekly rebuild of `latest`, so base-image fixes ship between commits
jobs:
container:
uses: ChiefGyk3D/git-your-ship-together/.github/workflows/container-release.yml@<sha> # vX.Y.Z
permissions:
contents: read
packages: write
id-token: write
attestations: write
security-events: write
secrets:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
with:
push: ${{ github.event_name != 'pull_request' }}
docker-test-command: docker run --rm "$IMAGE" python -c "import mypkg"
egress-policy: block
doppler-project: ci
doppler-config: ci
doppler-identity-id: ${{ vars.DOPPLER_IDENTITY_ID }}-
Hardening gates (2026-10-03). hadolint on the Dockerfile; a non-root check in the workflow itself
(
require-non-root, default on; fix is aUSERinstruction); an opt-in read-only root filesystem probe; andtrivy-exit-codenow defaults to"1", withtrivy-ignore-unfixedso an advisory with no fix does not block. A caller with a fixable high or critical goes red until its base image or dependency moves;trivyignorestakes a.trivyignorewhose entries each carry a reason and a review date. -
Secret findings inside installed packages (2026-11-07). Trivy's
gcp-service-accountrule matched docstring text about an API enum value in the installedanthropicSDK (11 CRITICAL findings under/opt/venv/lib/python3.14/site-packages/anthropic/on Boon-Tube-Daemon's image); the newest SDK has it and no fixed version exists.skip-secret-scan-in-site-packages: true(defaultfalse) makes Trivy drop all secret findings (every secret rule; it still reads the files, so this is not a performance boundary) for files matched by oneallow-rulespath entry, anchored at the image root, underusr/lib,usr/lib64,usr/local/lib,usr/local/lib64andopt/venv/lib, each followed bypythonX.Y/site-packages/(numeric version), anchored at the image root. The path is^(usr/(local/)?lib(64)?|opt/venv/lib)/python[0-9]+\.[0-9]+/site-packages/; Trivy matches image paths without a leading slash (measured with Trivy 0.76.2 and 0.70.0, the version trivy-action v0.36.0 installs by default). The config is passed throughTRIVY_SECRET_CONFIG(the--secret-configflag; trivy-action has no input for it). The vulnerability scan, severity,ignore-unfixedand exit code are untouched. Tradeoff: a genuine secret shipped by a dependency under those roots will NOT be detected; secrets at every other path are still found. The rule is path-wide because Trivy documents per-rule allow rules only inside custom rules, and a custom rule with a built-in's id runs beside the built-in instead of replacing it. Fork pull requests: a caller that passes this input onpull_requestevents lets an untrusted pull request's image weaken only its own secret detection; publishing is already gated off for pull requests. Source: Trivy secret scanning docs, "Allow Rules", read 2026-11-07. -
A red Trivy scan names what tripped it. When the scan step fails, a following
Summarize a failed Trivy scanstep (inputs.trivy && failure(), 2 minutes at most, no network) prints, from the SARIF the scan already wrote, the totals by severity and one row per rule id and file path with its count, secret rules first. It never prints the matched text, a message or a snippet, and it always exits 0, so it never changes pass or fail. When every secret hit is undersite-packages, it adds one line pointing atskip-secret-scan-in-site-packages: true(opt-in, left off by default; CVE scanning stays on). Source and tests:scripts/trivy_sarif_summary.py,tests/test_trivy_sarif_summary.py. -
Trivy's setuptools finding may be pip's. pip vendors its own setuptools and msgpack under
pip/_vendor, so upgrading setuptools in the image clears nothing;pip uninstall -y pipas the last build step does. - Temporary tags stay in GHCR beside the index; delete them when you no longer need them.
-
The signing certificate names the innermost workflow. Verify with
--certificate-identity-regexp(^https://github.com/ChiefGyk3D/git-your-ship-together/), which matches this file and the old name alike.
Inputs (42), read from container-release.yml:
| Input | Type | Default | Meaning |
|---|---|---|---|
dockerfile |
string | Dockerfile |
Path to the Dockerfile. |
context |
string | . |
Build context. |
platforms |
string | linux/amd64,linux/arm64 |
Platforms for the published image. |
image-name |
string | empty | Image name under ghcr.io. Defaults to the repository name, lower-cased. |
push |
boolean | false |
Publish. False builds, tests and scans only. |
tags |
string | type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha type=raw,value=latest,enable={{is_default_branch}} |
docker/metadata-action tag rules. |
signer-identity-regexp |
string | ^https://github\.com/ChiefGyk3D/git-your-ship-together/\.github/workflows/container-release\.yml@ |
Certificate identity the merge job's own signature and SBOM attestation must match (checked before the release tags move). It is validated before anything is pushed: it must start with ^https://github\.com/, name a workflow file under .github/workflows/, end with @, and use no metacharacter except an escaped dot. The default names this reusable workflow; a fork of it sets its own. |
allow-unsigned-publish |
boolean | false |
Let a publishing run move the release tags with sign, sbom or provenance turned off. Default false: a run that would publish with any of the three off fails before it builds, so an unsigned image cannot reach latest by accident. A run that does not publish is not affected. |
docker-test-command |
string | empty | Shell run against the locally built image; $IMAGE names it. Empty skips the check. |
hadolint |
boolean | true |
Lint the Dockerfile with hadolint before building. |
hadolint-version |
string | 2.15.1 |
hadolint release to download (hadolint/hadolint), without the v. Changing it means changing both hadolint-sha256-* inputs. |
hadolint-sha256-amd64 |
string | c7187db94eeeeca956519a6af171adc31453941a1e777961f6e680f697c8c507 |
SHA-256 of the hadolint-linux-x86_64 binary for that version. |
hadolint-sha256-arm64 |
string | f6198ef8090f404dbb771abfee086eb8c48ac177f30da7fd3510aca35b344b5d |
SHA-256 of the hadolint-linux-arm64 binary for that version. |
hadolint-args |
string | --failure-threshold warning |
Arguments passed to hadolint before the Dockerfile path, split on whitespace. |
hadolint-continue-on-error |
boolean | false |
Report hadolint findings without failing the job. For a repository adopting the linter before its Dockerfile is clean. |
require-non-root |
boolean | true |
Fail when the built image runs as root (id -u prints 0). The fix is a USER instruction in the Dockerfile. Needs an id binary in the image; turn it off for a distroless or scratch image. |
probe-read-only |
boolean | false |
Also run the image with a read-only root filesystem (--read-only --tmpfs /tmp) and fail if it breaks. Enable once the image is known to write only under tmpfs or volumes. |
probe-command |
string | empty | Arguments for the read-only probe, which runs docker run --rm --read-only --tmpfs /tmp "$IMAGE" <probe-command> with the image's own entrypoint. Must exit on its own, such as --version. Required when probe-read-only is true. |
dockerhub |
boolean | false |
Also publish to Docker Hub when the Doppler config holds DOCKERHUB_USERNAME and DOCKERHUB_TOKEN. |
dockerhub-repository |
string | empty | Docker Hub repository name (without the namespace). Defaults to the repository name, lower-cased. |
sign |
boolean | true |
Sign the published image with cosign (keyless). |
sbom |
boolean | true |
Generate an SPDX SBOM with syft and attach it as a cosign attestation. |
provenance |
boolean | true |
Record SLSA build provenance with GitHub Artifact Attestations. |
trivy |
boolean | true |
Scan the built image with Trivy and upload SARIF. |
trivy-severity |
string | CRITICAL,HIGH |
Severities Trivy reports. |
trivy-exit-code |
string | 1 |
Trivy exit code when findings exist. "1" (the default) makes findings fail the job; "0" reports only. |
trivy-ignore-unfixed |
boolean | true |
Skip advisories that have no fix in the distribution, so they do not block the gate. |
skip-secret-scan-in-site-packages |
boolean | false |
Suppress ALL Trivy secret findings (every secret rule, not one rule id) from files under three image roots only: usr/lib[64], usr/local/lib[64] and opt/venv/lib, each pythonX.Y/site-packages. Reason: a package's docstring text can match a secret rule (the anthropic SDK's text about an API enum value matches gcp-service-account) when nothing is a credential and no fixed version exists. Trivy still reads those files (this is not a performance boundary) and only secret findings are affected: the vulnerability scan, severity, ignore-unfixed and exit code are unchanged. A real secret shipped inside a dependency under those roots will NOT be detected (a supply-chain tradeoff); secrets at every other path are still found. |
trivyignores |
string | empty | Path to the caller's .trivyignore file, relative to the repository. Empty means none. Every entry needs a reason and a review date. |
egress-policy |
string | audit |
harden-runner egress policy - audit logs outbound connections, block allows only allowed-endpoints. Jobs that hold no secret follow egress-policy-secretless instead (EX-0001). |
egress-policy-secretless |
string | block |
harden-runner egress policy for the jobs that hold no stored secret, no OIDC token and no write-scoped or publish-capable token (read-only contents, a SARIF upload at most), and whose output no privileged job consumes - exactly audit or block. Defaults to block since security exception EX-0001 (GitHub-hosted runners in westus2 broke harden-runner block) was closed on 2026-11-02 after harden-runner v2.22.3 passed on westus2; see docs/security/exceptions/. Every job still has the default read-only job token. Set audit to opt out if the defect recurs. Any other job follows egress-policy. Any other value fails the job. |
allowed-endpoints |
string | api.doppler.com:443 api.github.com:443 auth.docker.io:443 check.trivy.dev:443 deb.debian.org:80 files.pythonhosted.org:443 fulcio.sigstore.dev:443 get.trivy.dev:443 ghcr.io:443 github.com:443 index.docker.io:443 mirror.gcr.io:443 pkg-containers.githubusercontent.com:443 production.cloudfront.docker.com:443 pypi.org:443 raw.githubusercontent.com:443 registry-1.docker.io:443 rekor.sigstore.dev:443 release-assets.githubusercontent.com:443 timestamp.sigstore.dev:443 tuf-repo-cdn.sigstore.dev:443 |
harden-runner allow-list for block, space-separated host:port entries. The default is every endpoint this workflow's jobs reached in audit mode across the calling repositories; the runner's own infrastructure needs no entry. Wildcards are not supported and a newline-separated list matches nothing. |
extra-allowed-endpoints |
string | empty | Appended to allowed-endpoints, for hosts only this repository reaches, such as an apt repository its Dockerfile adds. Same format. |
doppler-project |
string | empty | Doppler project slug. |
doppler-config |
string | empty | Doppler config slug holding CI secrets. |
doppler-identity-id |
string | empty | Doppler Service Account Identity UUID for OIDC. |
doppler-trusted-refs-only |
boolean | true |
Fetch CI secrets only on the default branch, a version tag (vN.N.N) or a schedule; never on a pull request or another branch. false restores fetching on every same-repository run. |
allowed-publish-events |
string | push |
Comma-separated event names (github.event_name) from which push may publish. Default push. * allows every event except pull_request and pull_request_target, which never publish. Together with require-tag-ref this is the allow-list for pushing, signing and attesting. |
require-tag-ref |
boolean | true |
Publish only from a refs/tags/v* ref. false also allows other refs, for a caller that publishes from a branch on purpose. |
runs-on |
string | "ubuntu-24.04" |
Runner for the non-matrix jobs, as a JSON string, because runs-on takes a string, an array or an object: "ubuntu-24.04", ["self-hosted","linux"] or {"group":"my-group","labels":["linux"]}. The default parses to the label these jobs always used. Invalid JSON fails the job at expression time. The per-platform build jobs keep using their GitHub-hosted matrix runners. |
allow-self-hosted |
boolean | false |
Let these jobs run on a self-hosted runner (default false: on any runner that is not GitHub-hosted the job fails). Setting it true is the caller's attestation that the runner is ephemeral, one job per VM, and isolated from secrets and the network. Even then a self-hosted runner takes only push, schedule, workflow_dispatch, release and same-repository pull_request events. Secret-bearing jobs belong on GitHub-hosted runners or a distinct ephemeral trusted pool. |
timeout-minutes |
number | 60 |
Job timeout. Multi-arch builds that compile native code need a generous one. |
Secrets a caller may pass, by name:
| Secret | Required | Meaning |
|---|---|---|
DOPPLER_TOKEN |
no | Doppler Service Token fallback when OIDC is not configured. |
Outputs a caller job can read:
| Output | Meaning |
|---|---|
digest |
Digest of the published image index (empty when not pushed). |
image |
The GHCR image reference by digest (empty when not pushed). |
runs-on is a JSON string that every job reads through fromJSON(inputs.runs-on), because runs-on takes a string, an
array or an object: '"ubuntu-latest"' (the default), '["self-hosted","linux"]' or '{"group":"my-group","labels":["linux"]}'.
Invalid JSON fails the job at expression time. allow-self-hosted (default false) is the caller's attestation that a
self-hosted runner is ephemeral, one job per VM, and isolated from secrets and the network. Without it, a step right after harden-runner in every
job fails on any runner that is not GitHub-hosted. With it, a self-hosted runner still takes only push, schedule,
workflow_dispatch, release and same-repository pull_request events. The build and build-local jobs keep their GitHub-hosted matrix runners and ignore runs-on.
It never pushes, signs or attests from a pull request, never reads the Actions cache while building a release, and never ships an image that runs as root unless the caller turns the check off.
Generated from docs/wiki/ at commit f3af2fa0bae3. Do not edit this wiki: the next push to main replaces every page. Corrections go to docs/wiki/ by pull request.
GYST
- Home
- Why GYST exists
- Getting started
- Design rules
- Secrets: Doppler and OIDC
- Security scanning explained
- The baseline and the weekly audit
- Releases and supply chain
- Keeping a project board current
- Adopting GYST in your own project
- Glossary
- Roadmap
Learn and contribute
- Learning path
- Which workflow do I need?
- Repository map
- Egress control
- Troubleshooting
- Lessons learned
- Testing and the contract
- Contributing and developing
- Maintaining this wiki
- Verify main
- FAQ
CI
Security
Release
- container-release
- python-docker-release
- python-package-release
- artifact-release
- verify-published
- base-image-digest
Docs and project
- docs-pages
- wiki-publish
- project-sync
- threat-model
- lory-audit
- agent-scan
- token-drift
- node-typecheck
- pr-title-lint
- vendored-drift
- upstream-sync
- repin
- pin-comments
Tools