Reusable GitHub workflows that build, lint, test, scan, publish and release Docker container images for the Linux Foundation. The workflows support both GitHub-native projects and projects where Gerrit serves as the source of truth (dispatched through gerrit_to_platform), and handle single Dockerfile repositories through to multi-image monorepos with same-repository FROM chains.
The design research behind this repository, including the ONAP container-build census the workflows target, lives in docs/BRIEF.md. A function-by-function comparison with the Jenkins container jobs these workflows replace lives in docs/PARITY.md.
| Workflow | Trigger context | Status | Purpose |
|---|---|---|---|
.github/workflows/build-test.yaml |
Pull request / verify | Implemented | Discovery, buildx build, hadolint, tests, SBOM, Grype, release-file check |
.github/workflows/build-test-release.yaml |
Tag push (Model A) | Implemented | Tag-validated multi-platform build/push to GHCR/Docker Hub/Nexus 3, cosign + SLSA |
.github/workflows/merge.yaml |
Merge (Model B) | Implemented | Gated snapshot/staging publish (version.properties) + crane promotion |
Thin caller examples live under examples/, with a GitHub-native and
a Gerrit-wrapped variant per workflow.
Two release models cover the LF project estate:
- Model A (tag-driven) —
build-test-release.yaml. A validated, signed semver tag drives the version. Images build (multi-platform capable) and push to GHCR (ghcr.io/<owner>/<name>) and optionally Docker Hub (docker.io/<namespace>/<name>) and a Nexus 3 registry (<registry>/<namespace>/<name>), each pushed image signs with Sigstore cosign (keyless, by digest) and gains an SLSA build provenance attestation, and the audits gate promotion of the draft GitHub release (with per-image SBOMs and a digest manifest attached). See Movinglatestfor when the release becomes the Latest GitHub release and each image'slatesttag moves. - Model B (merge-driven) —
merge.yaml. The Jenkins-heritage LF/Gerrit flow: every merge builds the images, gates them on hadolint, the test hook and a Grype scan of their SBOMs, and pushes the snapshot/staging tag set to the snapshot registry, versioned fromversion.properties. Merging areleases/or.releases/file withdistribution_type: containerthat passes the release container schema triggers a registry-side promotion: docker-promote-action copies the stagedname:versionimages to the release registry atcontainer_release_tag, under the same image namespace (see Image Namespace), preserving multi-architecture manifests without rebuilding. Promotion skips an image already released with the same digest, and fails on a release tag holding other bits (see merge.yaml).
Model B publishes this tag set per image, sharing one timestamp per
run (the Jenkins include-docker-push.sh/fabric8 idiom):
<method tag> under a tag_method: latest, the stream
name or the image's container-tag.yaml tag
X.Y.Z-SNAPSHOT-latest rolling snapshot
X.Y-STAGING-latest rolling staging
X.Y.Z-<ts>Z immutable, promotable tag (what container
release files reference)
The last three need a version.properties version. With a
tag_method and no version.properties, the method's tag stands
alone; see Tag methods.
Signing and provenance are registry-aware because registries differ in what supply-chain artefacts they accept. Model A routes around the gaps rather than assuming every target behaves like GHCR:
| Registry | OCI referrers API | cosign v3 bundle signature | Legacy .sig signature |
Provenance destination |
|---|---|---|---|---|
| GHCR | No (404) | Yes (fallback tag) | Yes | Pushed to the registry |
| Docker Hub | Unreliable | Untested | Yes | GitHub attestation store |
| Nexus 3 | No (404) | Untested (#114) | Yes (verified on 3.95.1) | GitHub attestation store |
| JFrog Artifactory | Unverified | Unverified | Unverified | GitHub attestation store |
Consequences for callers:
- Provenance pushes to the registry for GHCR images
(
push-to-registry) and nowhere else. Elsewhere the attestation lives in the GitHub attestation store, whichgh attestation verifyreads (see Verifying Releases). - Signatures run against every pushed image. A failure against a
registry named in
sigstore_sign_required_registriesfails the release; elsewhere the image publishes unsigned with a warning, so an unproven registry cannot take a release down. Add a registry to that input once testing proves it stores signatures. - Signature format. cosign v3.0.6, which
sigstore/cosign-installerv4.1.2 installs, writes each signature as a Sigstore bundle (application/vnd.dev.sigstore.bundle.v0.3+json) attached to the image digest as an OCI 1.1 referrer. Where the registry answers 404 for the referrers API, the referrer is instead listed in an OCI image index under a fallback tag namedsha256-<hex>, the image digest with no.sigsuffix. GHCR is such a registry: a real publish (#28) found the signature and the GHCR provenance sharing one fallback tag. The legacysha256-<hex>.sigsignature image is what cosign v2 wrote, and what cosign v3 writes when given--new-bundle-format=false --use-signing-config=false. Thesignature_formatinput chooses between the two: it defaults tobundle, and passes those two flags when set tolegacy. - Cleanup and retention. Policies that prune untagged or
non-release tags must keep both forms: the
sha256-<hex>fallback tags the defaultbundleformat writes, thesha256-<hex>.sigtagssignature_format: legacywrites, and any left by earlier signing. Without its fallback tag, cosign cannot find the signature (nor, on GHCR, the provenance), and untagged-manifest cleanup then deletes both.
The legacy result for Nexus 3 predates the bundle format: Nexus
3.95.1 accepted a legacy cosign signature push even with
strictContentTypeValidation enabled. The bundle path pushes a
different shape, a subject-bearing manifest with an
application/vnd.oci.empty.v1+json config and a fallback image
index. No test has yet shown whether Nexus 3 accepts it under
strict validation; #114 tracks that test, and
.github/workflows/nexus-signature-probe.yaml runs it on demand
against a Nexus 3 container, recording each format's result in its
step summary. The lane option that
issue also called for has since landed: signature_format selects
the legacy format, so a Nexus caller need not wait on the result.
No test has yet pushed a cosign v3 bundle to Docker Hub either,
which is why those cells read Untested.
Model A publishes to Nexus 3 through its registry input, and signs
there best effort: the default sigstore_sign_required_registries
leaves Nexus out, so a failed signature push warns rather than
failing the release. Name the registry's host:port there (for
example nexus3.onap.org:10002) to make it required. Until #114
settles whether Nexus stores the bundle format, signature_format: legacy selects the format verified there.
Its provenance lives in the GitHub attestation store.
Artifactory is addressable by merge.yaml (Model B), which accepts
its repository-path and subdomain forms alongside the Nexus
port-per-repository form. Its supply-chain columns above stay
Unverified: nothing has yet pushed a cosign signature to an
Artifactory instance from this lane, and Model B does not sign at all
(snapshot tags are transient). Model A's registry input accepts the
same repository-path form (acme.jfrog.io/docker-release) and logs
in to its host, so Artifactory drops in there too, but nothing has
released to a live instance that way yet — tracked in #26.
The signing certificate behind every signature and attestation this
lane makes names the reusable workflow, not the caller, as the
signer: its SAN (the Build Signer URI) is
https://github.com/lfreleng-actions/docker-workflows/.github/workflows/build-test-release.yaml@<ref>,
while the calling repository appears as the source repository. This
is deliberate. A verifier can require that a release came from the
organisation's sanctioned release lane, not from any workflow that
happens to live in the caller's repository.
Verification has to name the signer workflow.
gh attestation verify --owner <org> on its own fails with
Error: verifying with issuer "sigstore.dev" for any caller outside
lfreleng-actions, because --owner also expects the signer
workflow to belong to that organisation. --owner (or --repo) is
still required: it names the calling organisation, where the
attestation lives. Add --signer-workflow to name the lane:
gh attestation verify oci://ghcr.io/<org>/<image>@sha256:<digest> \
--owner <org> \
--signer-workflow lfreleng-actions/docker-workflows/.github/workflows/build-test-release.yaml--signer-repo lfreleng-actions/docker-workflows is the looser
alternative, accepting any workflow in this repository. For GHCR
images, --bundle-from-oci reads the provenance from the registry
instead of the GitHub attestation store.
cosign matches the same identity, anchored at both ends so that the suffix must be a branch, tag or commit SHA ref of the workflow:
cosign verify ghcr.io/<org>/<image>@sha256:<digest> \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp '^https://github\.com/lfreleng-actions/docker-workflows/\.github/workflows/build-test-release\.yaml@(refs/(heads|tags)/.+|[0-9a-f]{40})$'cosign verify-attestation takes the same two certificate flags;
pass --type slsaprovenance1 to select the SLSA provenance.
The signatures are Sigstore bundles (see Registry Capability), which not every cosign reads:
| Verifier | Reads this lane's signatures |
|---|---|
| cosign v3 | Yes, by default |
| cosign v2.6.0 and later | With --new-bundle-format=true |
| cosign before v2.6.0 | No: it reports no signatures found |
On GHCR, plain cosign verify lists two entries for one image: the
signature (predicate type https://sigstore.dev/cosign/sign/v1) and
the SLSA provenance bundle (https://slsa.dev/provenance/v1).
Both are bundles signed by the same workflow identity and attached
to the same digest, so cosign reports both as verified signatures.
The second entry is the provenance, not a duplicate signature;
check the predicate type when a script counts signatures.
build-test.yaml (-> denotes sequence; { } runs in parallel):
gerrit-validate -> { repository-metadata | docker-metadata
| check-release }
docker-metadata -> { dockerfile-lint | build }
build -> { tests | sbom -> grype }
check-release -> release-verify
The dockerfile-lint (hadolint) job gates on docker-metadata rather than build: Dockerfile lint needs no built image, so lint findings surface even when the build itself fails. check-release and release-verify skip unless the caller sets the release registries (see Release-file checks).
build-test-release.yaml:
gerrit-validate -> { repository-metadata | tag-validate
| docker-metadata }
docker-metadata -> { dockerfile-lint | build }
tag-validate -> build -> sign
build -> sbom -> grype
{ dockerfile-lint | grype } -> tests -> attach-artefacts
-> promote-release
merge.yaml:
gerrit-validate -> { repository-metadata | docker-metadata
| resolve-version | check-release }
docker-metadata -> { dockerfile-lint | build }
build -> { tests | sbom -> grype }
check-release -> release-publish
{ resolve-version | dockerfile-lint | tests | sbom | grype
| release-publish } -> snapshot-publish
The merge lane gates, then stages. Its lint, test, SBOM and Grype
jobs match build-test.yaml's. hadolint lints the Dockerfiles the
build consumed. The tests and SBOM generation read the image archives
the build job uploads, the same bits snapshot-publish pushes, and
Grype scans the SBOMs generated from them. Every snapshot tag is a
promotable candidate, so snapshot-publish waits until each enabled
gate passes; it depends on sbom directly as well as through
grype, so an SBOM failure blocks it even with Grype off. A gate
switched off by its input does not hold it back. release-publish
promotes staged images and builds nothing, so the gates do not apply
to it.
Promotion copies whatever a staged tag points at, and
snapshot-publish rewrites mutable tags: latest, a stream name, a
container-tag.yaml tag and the rolling LF tags. To make a
release-file merge promote the images staged before it, not the ones
it rebuilds, snapshot-publish runs after the same run's
release-publish, whatever that job's result. It also joins the
promotion concurrency group described under
Moving latest, so no merge on another branch
rewrites a tag while a promotion of the repository reads it.
The docker-metadata job resolves the image list with
docker-build-matrix-action.
With no images input it walks path_prefix for Dockerfiles at the
locations observed across the LF project estate:
Dockerfile(repository root)docker/Dockerfilesrc/main/docker/Dockerfile(Maven convention)<dir>/Dockerfile(one-level per-image directories)
Image names derive from the repository or directory name. Pass the
images JSON input to override discovery; its array order is the
build order, which also serves same-repository FROM chains (an image
can build FROM <earlier-image>:verify). Each entry takes name and
context (required), plus optional dockerfile, target,
build_args (a list of KEY=VALUE strings) and build_flags (a list
of extra docker buildx build arguments). Names in an explicit
images input must stay distinct once normalised to the Docker
repository character set; auto-discovery instead keeps the first of
any duplicate pair.
The select input narrows that list to a subset: comma- or
space-separated name globs, such as api-* or api-* worker,
matched against the image names that discovery or the images input
produced. With select_dependencies left at true, the selection
also takes in the same-repository images each selected one builds
FROM, so a partial build still resolves its chain; set it to
false to build the matched images alone. An empty select, the
default, builds every image. A selection that matches no image fails
the docker-metadata job, since the build, test and publish jobs
cannot run on an empty image set. select cannot combine with
build_command, which builds whatever the project's tooling builds;
when a caller sets both, the gerrit-validate job fails the run
before any build.
select_changed: true, in the verify and merge lanes, limits the
build to the images the change under test touched. The docker-metadata job
asks
dependency-change-action
for every path the change touched: a pull request's or Gerrit
change's files against its base, or a push's against the commit
before it, which is why that job checks out the full history off
Gerrit. It hands that list to docker-build-matrix-action as
changed_files, which selects each image whose context, Dockerfile,
local build contexts or declared paths hold a changed file, plus
every same-repository image built FROM a selected one, so a base
image change rebuilds its children. A changed file inside
path_prefix that no image reads, a shared scripts/ directory for
example, builds every image. The release lane has no
select_changed: a release builds every image.
- Unresolved diff: when the action cannot prove what changed (a fixture checked out from another repository, a missing base), the list stays empty, change scoping turns off and every image builds, with a notice saying why. It never reads as "nothing changed".
- Empty selection: a change that touches no image builds none.
The run passes with a notice; the build job skips, and with it
every job that needs images, including the merge lane's
snapshot-publish, which stages nothing rather than failing. A selection that is not empty still fails the merge lane when the build saves no image archive. - Conflicts:
select_changedcannot combine withselectorbuild_command; thegerrit-validatejob fails the run when a caller sets either pair. - Safe failure: the selection reads the paths an image declares
and its Dockerfile references. An input it cannot see, such as a
file reached through a symbolic link, does not select its image, so
that image is not rebuilt and, in the merge lane, its earlier
snapshot stays the newest
(docker-build-matrix-action#39).
Leave
select_changedoff where that matters.
build-test.yaml and merge.yaml report the outcome as the
selection_reason workflow output (all, changed, shared or
none) and, under select_changed, changes_resolved (true or
false).
With an image namespace resolved (see
Image Namespace), the Dockerfile build path in
every lane tags each built image both as <namespace>/<name>:verify
and as <name>:verify, so a chain resolves whichever form it
references and one images input travels between the verify, merge
and release lanes unchanged. A publishing release build whose
platforms input is anything other than linux/amd64 — one foreign
architecture as readily as a list of them — runs on the isolated
docker-container driver, which cannot see daemon-local tags; there
each later build receives the earlier images by digest through
--build-context, so the same chains still resolve. The exception is
build_command, which hands back whatever tags the project's own
tooling created; chains built that way must reference
registry-resolvable images or take the base as a build_args value.
The qualifier matters for dry runs. A release build that publishes
nowhere produces one platform rather than a manifest list, so it
runs on the daemon-backed docker driver whatever platforms
asks for, and daemon-local chains resolve as they do elsewhere.
Where build_command builds the images, discovery finding no
Dockerfile is not an error: jib and Gradle plugins synthesise images
without one, and the build job enumerates whatever the command
created.
That enumeration is inference: the build step diffs the daemon's image list around the command and treats a registry digest as evidence that an image arrived from a registry instead of a local build. The evidence holds under Docker's classic image store, where a local build carries no digest. Under the containerd image store every image has one, so nothing distinguishes the two and the build stops with an error naming the images it could not attribute, rather than guessing and risking an unrelated base reaching the scan or publish jobs.
Declare the output with build_command_images in that case, and on
such a store when the builder stamps a reproducible creation
timestamp — jib pins it to the Unix epoch — since the build step then
has nothing left to tell a fresh build from a pulled base. On the
classic store those images need no declaring, because the absent
digest already identifies them.
Declaring skips the inference entirely. Each reference needs an explicit tag, a repeated reference is an error, and the build step clears any existing tag of that name before running the command, so on a daemon reused between runs a command that builds nothing cannot pass its previous image off as fresh output.
The build job builds with
docker-build-images-action,
which sets up buildx (and QEMU for foreign platforms) itself and
checks every images entry before anything builds. It loads images
into the runner's daemon in the verify and merge lanes, and pushes
them in the release lane, recording each pushed digest for signing.
The build job then exports every built image as a docker archive, so
the test, SBOM and scan jobs consume the exact bits built. Verify-lane
and merge-lane builds run single-platform (the runner's native
platform); the release lane builds multi-platform when the
platforms input lists more than one target.
In every lane the SBOM job downloads those archives
to ${{ runner.temp }}/docker-archives and runs
sbom-action in
image mode, which writes one CycloneDX 1.7 JSON document per archive,
sbom-cyclonedx-<archive-name>.json, and fails if there is no archive
to scan. The Grype job scans every one of them.
A common Java pattern packages a jar or war first and then copies it
into an image with COPY target/*.jar ...; Python projects can do the
same with wheels. The build_artifacts input, available in all three
lanes, hands that output to the image build: the build job downloads
each listed artefact and places its contents in the checkout before
any image builds, so a Dockerfile COPY and a build_command both
see the files.
The input is a JSON array of objects, each with a name and an
optional path. name is the artefact's name, limited to letters,
digits, ., _ and -. path defaults to . and is relative to
path_prefix: an entry's contents land at <path_prefix>/<path>.
An empty string (the default) or [] changes nothing: none of the
download steps runs.
with:
build_artifacts: >-
[{"name": "app-jars"}, {"name": "wheels", "path": "py"}]The artefacts must come from earlier jobs of the same workflow
run. The download passes no run-id and no github-token, and no
job gains a permission, so an artefact from another run or repository
cannot reach the build. The job calling the lane must needs: the job
that uploads the artefact; without it the upload may not have happened
yet, and the build fails saying so.
The build job checks everything before it builds and fails with an
::error:: naming the offending entry when:
- the input is not a JSON array of objects, or an entry lacks a
non-empty string
name; - a
nameholds a character outside[A-Za-z0-9._-]; - a
pathis absolute, contains a..segment, or otherwise resolves outsidepath_prefix(through a symlink, say); - a named artefact does not exist in this run;
- a downloaded file would overwrite a file the checkout holds, or two entries would place the same file.
Artefacts add to the source tree and never replace it, so no artefact can swap a Dockerfile or script for its own. The job copies nothing unless every file passes. The build job alone downloads them: discovery, Dockerfile lint, the tests, SBOM and scan jobs read the source, where Dockerfiles live, or the built images.
An entry may also carry an id and a digest: the artifact-id and
digest outputs of
build-artifact-action
in pack mode, which uploads a tar and a digest manifest rather than
the files themselves. An entry with an id names such a packed
artefact; one without, or with an empty id, names a raw artefact
and the lane reads it as above. One artefact has one format, so a
name may not appear both with and without an id.
with:
build_artifacts: >-
[{"name": "app-jars",
"id": "${{ needs.build.outputs.artifact-id }}",
"digest": "${{ needs.build.outputs.digest }}"}]The build job unpacks each packed entry with build-artifact-action
in unpack mode, with overlay: 'true', into
<path_prefix>/<path>, creating that directory first when the
checkout lacks it. The action downloads this run's artefact by ID,
with no token, refuses a manifest that names another run, extracts
nothing unless the manifest hashes to digest (when given) and
matches the tar, and fails on any file that already exists, the
checkout's or one an earlier entry added. The raw placement steps
never touch a packed entry. The build job also fails before anything
downloads when:
idis not a positive integer, as a number or a string of digits;digestis not 64 lower-case hex characters, or comes without anid;<path_prefix>/<path>is not.or segments of[A-Za-z0-9._-], the form the action accepts, passes through a file or a symlink in the checkout, or names another directory once a symlink inpath_prefixresolves (link/..);- more than four entries carry an
id: the job has four fixed unpack steps, as a job cannot loop over steps.
Each unpack adds its whole artefact or nothing, and entries add one
after another, raw ones first. When any of them fails, a rollback
step removes every path they added under path_prefix, files and
directories alike, nested directories whose packed mode denies access
included, so a failure leaves the checkout unchanged, and
the job fails before any image builds.
java-workflows (v0.7.0 or later) uploads its packaged output with
upload_build_artifacts: true, and reports the artefact as the
build_artifact_name, build_artifact_shape and
build_artifact_count outputs, as a raw artefact. Its reactor shape keeps each
packaged file at its module-relative path below path_prefix
(app/target/app-1.0.jar), so the default path of . puts every
jar where its module's Dockerfile expects it, when both lanes share a
path_prefix. The m2repo shape, a Maven repository tree a deploy
phase wrote, does not map onto module paths; guard the Docker job on
build_artifact_shape == 'reactor'. examples/build-artifacts/ shows
the whole caller, in a GitHub and a Gerrit form.
namespace_mode decides the namespace every lane prefixes to image
names, and namespace supplies it in manual mode:
| Mode | Namespace |
|---|---|
none |
Default. No namespace: images keep their bare names |
auto |
The lowercased owner of the repository the lane builds |
manual |
The namespace input, e.g. onap or onap/so |
Each lane resolves it once per run, in its first job
(gerrit-validate), and every other job reads that job's namespace
output, so the build aliases, the merge lane's snapshot publish and
release promotion, and the release lane's Docker Hub and registry
paths all agree.
That job fails before anything builds on an unknown mode, on manual
without a namespace, on a namespace under any other mode
(rather than ignoring it), and on a value outside Docker's repository path
grammar: /-separated components, each of lowercase alphanumerics
joined by a single . or _, a doubled __, or one or more -.
The release lane's dockerhub_publish also needs a namespace, and a
single component at that, since a Docker Hub namespace is one
organisation or user; GHCR publishes under the calling repository
owner whatever the mode. The release lane's registry input
publishes as <registry>/<namespace>/<name>, or <registry>/<name>
under none, as the merge lane's snapshots do.
docker-promote-action's namespace mode holds these rules for
every lane, and its own suite tests them;
tests/test_namespace_mode.sh checks each lane calls it at the
shared pin with its namespace inputs.
auto takes the owner of the repository input (or of the calling
repository when that is empty), since a lane can build another
repository than the one calling it. That matches the Jenkins
namespace for projects whose GitHub organisation carries the
registry name — ONAP, OpenDaylight, O-RAN-SC and OPNFV. Projects
whose GitHub organisation differs from their Gerrit host, such as
FD.io (FDio) or Akraino (akraino-edge-stack), should use
manual.
In the merge lane the namespace applies to both halves. Snapshot and
staging tags publish as <snapshot_registry>/<namespace>/<name>, where
<name> is the image's full name, sub-paths included, and
release promotion copies <pull>/<namespace>/<name>:<version> to
<push>/<namespace>/<name>:<container_release_tag> (and latest),
where the pull and push registries are the release file's overrides
or the lane's inputs. Container names in release files are relative
to the namespace: ONAP's never start with onap/, and some carry
sub-paths such as so/sdnc-adapter. That is how global-jjb's
release-job.sh builds <registry>/<umbrella>/<name>, so the same
release files promote the same images. Promotion never strips a
prefix: a name that already starts with <namespace>/ gains the
namespace again (onap/app resolves to onap/onap/app), as in
Jenkins, with a notice that it looks double-prefixed. Promotion
resolves every path before it copies anything, and fails when a name
appears twice or a path, with the registry's own path, exceeds 255
characters. The snapshot publish checks its paths the same way
before it pushes anything, and fails when two images resolve to the
same path.
| Input | Type | Default | Description |
|---|---|---|---|
repository |
string | '' |
Repository to check out (owner/name); empty uses the caller |
ref |
string | '' |
Branch/tag/SHA to check out (empty = default branch) |
checkout_submodules |
boolean | false |
Check out git submodules in every checkout, on the Gerrit and plain paths alike |
path_prefix |
string | '.' |
Path to the project root directory |
build_artifacts |
string | '' |
JSON list of same-run artefacts to place first; see Build Artifacts |
images |
string | '' |
JSON image list (see Image Discovery); empty string auto-discovers |
select |
string | '' |
Image name globs choosing a subset (see Image Discovery); empty builds every image |
select_dependencies |
boolean | true |
With select, also build the same-repository images the selected ones build FROM |
select_changed |
boolean | false |
Build the images the change touched and their dependents, not all (see Image Discovery) |
namespace_mode |
string | 'none' |
none, auto or manual; see Image Namespace |
namespace |
string | '' |
Namespace for manual (e.g. onap -> onap/<name>) |
build_command |
string | '' |
Escape hatch: project tooling builds the images (make/mvn/gradle) |
build_command_images |
string | '' |
Images build_command produces; declaring them skips inference |
build_timeout_minutes |
number | 30 |
Timeout for the build job in whole minutes |
build_permit_fail |
boolean | false |
Permit image build failures; images that build carry on downstream |
test_command |
string | '' |
Smoke-test hook; built images load first, IMAGES env carries tags |
test_permit_fail |
boolean | false |
Permit test failures without failing the workflow |
lint_enabled |
boolean | true |
Run the Dockerfile lint job; false skips it |
lint_permit_fail |
boolean | false |
Permit hadolint findings (the NO_BLOCK pattern) |
audit_permit_fail |
boolean | false |
DEPRECATED alias for lint_permit_fail; removed at the next major |
sbom_enabled |
boolean | true |
Generate image SBOMs; false skips generation and the Grype scan |
grype_enabled |
boolean | true |
Run the Grype scan; false keeps the SBOMs but skips the scan |
grype_fail_on |
string | 'medium' |
Severity threshold that fails the Grype scan |
grype_permit_fail |
boolean | false |
Permit Grype findings without failing the job |
grype_cache_db |
string | 'true' |
Grype database cache mode; parallel callers need a single writer |
grype_gate_when |
string | 'always' |
always or dependencies-changed; see Dependency-change gating |
grype_dependency_ecosystems |
string | 'docker' |
Presets the gate watches besides docker (csv); see Dependency-change gating |
grype_dependency_patterns |
string | '' |
Extra patterns, one per line, added to the presets; see Dependency-change gating |
grype_dependency_policy |
string | 'declared' |
declared or all: which findings count against grype_fail_on; see Dependency-change gating |
grype_transitive_fail_on |
string | 'critical' |
Inherited-package bar under declared; no effect on image SBOMs, see Dependency-change gating |
grype_only_fixed |
boolean | true |
Count findings that have a fix alone; see Dependency-change gating |
grype_remediation_window_days |
string | '' |
Grace days for a withheld gate under dependencies-changed alone; empty disables the window |
grype_remediation_window_start |
string | '' |
YYYY-MM-DD start of the remediation window for findings that predate it |
grype_bypass_repository |
string | '' |
owner/name holding approved BYPASS: issues; empty reads the calling repository |
snapshot_registry |
string | '' |
merge.yaml's snapshot registry; enables release-file checks |
release_registry |
string | '' |
merge.yaml's release registry; enables release-file checks |
registry_user |
string | '' |
Registry username override; empty derives from the repository name |
harden_runner_egress |
string | 'block' |
Harden-runner egress policy: block or audit; see Egress allow-list |
harden_runner_allowlist |
string | (pinned) | Baseline harden-runner allow-list; see Egress allow-list |
harden_runner_supplemental_allowlist |
string | '' |
Further allow-list merged with the baseline; see Egress allow-list |
harden_runner_supplemental_unpinned |
boolean | false |
Let a same-organisation supplemental list omit @ref; see Egress allow-list |
harden_runner_extra_endpoints |
string | '' |
Inline host[:port] endpoints for short-lived fixes; see Egress allow-list |
build_permit_egress_traffic |
boolean | false |
Audit egress scoped to the build job (un-enumerable base registries) |
gerrit_refspec |
string | '' |
Gerrit refspec of the change under test |
gerrit_project |
string | '' |
Gerrit project name |
gerrit_branch |
string | '' |
Gerrit target branch |
gerrit_url |
string | '' |
Gerrit server URL; empty falls back to the GERRIT_URL variable |
Two optional secrets, OP_SERVICE_ACCOUNT_TOKEN and
VAULT_MAPPING_JSON, load the registry credential the release-file
checks use; nothing else in the lane needs them. Lint, test and scan
failures honour the org-wide NO_BLOCK_AUDIT_FAIL repository
variable as a runtime escape hatch alongside the per-call
*_permit_fail inputs.
grype_cache_db decides how the Grype scan uses the Actions cache for
its vulnerability database. The cache keys rotate on the database
build time, so one job at most may write a given prefix. A caller
invoking a lane once needs nothing here. A caller invoking it in
parallel, a matrix leg per component, should leave one call saving and
switch the rest to restoring without saving; where two jobs save,
creation order and build order can disagree, and a restore then
returns an older database than the newest saved. Grype rejects a
database built more than five days ago, so a cache that drifts stale
fails the scan rather than slowing it.
The input's own description names the three modes, and
examples/build-test/ shows the parallel arrangement.
The Grype scan gates every run by default. grype_gate_when: 'dependencies-changed' keeps the scan running on every change but
lets it fail the run when the change touched the dependency chain
and report without failing otherwise, so a documentation fix does
not block on a vulnerability that landed in a base image overnight.
Detection runs once, in the repository-metadata job, through the
dependency change detection of repository-metadata-action, which runs
dependency-change-action
against that job's checkout. It compares the commit under test with
its base: the first parent on a Gerrit patch set or a pull request's
merge commit, and the commit the branch held before a push. The
checkout fetches full history (a Gerrit change, two commits), so the
base is present; a repository or ref input, a scheduled run or a
manual one has no base at all, so each of those gates. The job
exports the verdict as its dependencies_changed output, true,
false or empty, and the scan reads it with dependencies-changed.
The lane fails closed: when repository-metadata fails or skips, the
scan still runs and receives an empty verdict, which gates. The
grype_gate_active and grype_gate_reason workflow outputs report
the decision.
grype_dependency_ecosystems names the file presets of the
application the images build, docker,python say. The action
watches every preset when a caller names none; this lane narrows it
to the images' own dependency set, and the docker
preset is always included, whatever the input says: it covers
Dockerfile, Dockerfile.*, *.Dockerfile, Containerfile,
Containerfile.* and the lower-case *.dockerfile, at any depth
under path_prefix. Where the images input names a dockerfile
the preset would miss, docker/alpine.df say, the lane passes that
path to the action as an extra pattern, so a change to it counts. An
image's context holds the application's manifests, and its
Dockerfile when the entry names no dockerfile, and a local
--build-context name=source in its build_flags names a directory
the recipe copies from; a context, named build context or recipe
outside path_prefix (../shared, or ../shared/Image.df) lies
outside the scope the presets search, so the lane widens the
detection to the repository root and makes every pattern
repository-relative; over-matching costs one strict run. An
oci-layout:// build context is a local directory too, scoped the
same way. A remote
build context (an image, a URL, a git reference, another stage) is
not a path and does not count. A path no
pattern can express at all, one outside the repository, with a [,
], ?, ** or \ in its name, with a newline or another control
character, or one the action would read as another path (whitespace
at either end of the name, or a Unicode line separator inside it,
which the action's line-per-pattern input strips or splits), and a
--build-context value buildx would refuse, skips
the detection, with a notice in the step summary naming the file,
and the gate stays on. So does build_command: the command builds
whatever it likes from wherever it likes, so discovery does not
describe its dependency set, and a caller with a custom build stays
on the full gate, with a notice in the step summary. The verdict
travels as a job output alone, so no file committed to the
repository can stand in for one. The action's README lists every preset's files,
its base selection and the rule for symlinks. Detection watches the
files that declare or lock dependencies and does not follow
build-time indirection: a base image a caller's build_args selects
for a FROM, or a build artefact a sibling project outside
path_prefix produces, lies beyond it, so a repository whose image
dependencies arrive that way stays on grype_gate_when: 'always',
the default, or widens path_prefix. The lane trusts no
claim it cannot verify: when the action finds no base to compare
with, the scan treats the change as having touched the dependency
chain and gates. Two self-test calls cover the round trip:
build-test-dependency-gate builds a fixture checked out at a tag,
which has no base, and asserts the gate stays active with the reason
the dependency-change signal was unavailable;
build-test-dependency-gate-resolved builds
tests/fixtures/dependency-gate from the pull request's own commit,
where the action resolves the base, and requires grype_gate_active
false with the reason this change did not touch the dependency chain, or true when the pull request edits a recipe the action
sees from that fixture: one under it, or one directly in
tests/fixtures, tests or the repository root, where the action
anchors its presets as well.
grype_dependency_patterns adds files no preset covers, one pattern
per line: a file that pins a base image tag, say. The lane appends
them to the patterns the step derives from images, and they follow
dependency-change-action's
pattern grammar,
matched against the detection scope: path_prefix, or the
repository root where the lane widens the scope. The detector checks
them, not gerrit-validate, so a pattern it rejects fails the
repository-metadata job, which runs beside the build, and the scan
then gates.
The remaining inputs pass through to grype-scan-action. Both verify lanes accept them, but a release always gates, so the remediation window below changes nothing there:
-
grype_only_fixed(defaulttrue) counts a finding when a fix exists and lets an unfixable finding report without failing. -
grype_remediation_window_daysandgrype_remediation_window_startbound the leniency of one case: agrype_gate_when: 'dependencies-changed'run whose change left the dependency chain alone, where the signal withholds the gate. There a fixed finding stays a warning for that count of days, counted from its fix date or from the start date for findings that predate it, and then gates as in an armed run. On analwaysrun, on a release, and on a change that touched the dependency chain, a qualifying finding fails at once, window or not. An empty days input disables the window. The action rejects a start the calendar lacks. -
grype_dependency_policyandgrype_transitive_fail_ondefault todeclaredandcriticalin these workflows; the action's own defaults areallandnone. Underdeclaredthe action gates a finding in a package the project declares atgrype_fail_onand one in an inherited package atgrype_transitive_fail_on, but it reads the declared set from a CycloneDX dependency graph solely for the generators and schema versions it has measured (CycloneDX 1.4 to 1.6 from the Maven, Gradle, Python and Cargo generators). The image SBOMs here come from syft at CycloneDX 1.7, which it cannot classify, so it falls back to counting every package as declared: every finding gates atgrype_fail_on,grype_transitive_fail_onhas no effect, anddeclaredbehaves likeall. Setgrype_dependency_policy: 'all'to say so outright; the relief for an image comes fromgrype_gate_when, not from the policy. -
grype_bypass_repository, in every lane, names theowner/namerepository whose labelledBYPASS:issues the scan accepts; empty, the default, reads the calling repository. Repositories that name the same one share its bypass list. The scan reads it with the workflow'sGITHUB_TOKEN, and a list it cannot read leaves no bypass, so the gate stays closed.
merge.yaml takes grype_only_fixed, grype_dependency_policy and
grype_transitive_fail_on too, at grype-scan-action's own defaults
(false, all and none), so its verdict stays the one it gave
before it had them; it has no grype_gate_when and always gates.
gerrit-validate validates each of these inputs, and grype_fail_on,
grype_cache_db and grype_bypass_repository in every lane, before
any job runs: it calls grype-scan-action at the scan's pin, asking
it to check its inputs and stop, with the same inputs the scan
receives, less the SBOM, so the rules are the action's own and cannot
drift from what the scan accepts. The action installs no Grype, fetches no
database and makes no network request in that mode; a bad value
fails the job with an annotation naming the input.
grype_dependency_ecosystems is an input of
repository-metadata-action, not of the scan, so gerrit-validate
checks it in a shell step of its own.
Jenkins' gerrit-release-verify rejects a bad container release file
before it merges. This lane does the same once the caller passes
snapshot_registry and release_registry, with the values its
merge.yaml caller receives; without them the two jobs below skip,
and the lane behaves as before. A change that adds or edits a
releases/ or .releases/ file with distribution_type: container
then goes through two jobs, neither of which touches the image
build:
- check-release runs
docker-release-detect-action, the stepmerge.yamlruns once the file merges, with the same registries. Detection needs no network access or credential. A malformed file fails the run with an annotation naming the file and the field: a missing or invalidcontainer_release_tag, a bad container name or version, more than one container release file across the two directories, or a registry override leaving the configured host. When it finds a file, the job then runs verify-release-schema-action, Jenkins'lftools schema verifyagainst the release container schema, on the path detection reports. The schema catches what detection does not check: a missingprojectorref, an emptyref, or an unquoted numericcontainer_release_tagsuch as1.10. The step installsuv, a Python build andlftools-uv(pinned), so it reaches GitHub,releases.astral.sh,pypi.organdfiles.pythonhosted.org, all on the default allow-list; a change without a release file skips it. - release-verify runs
docker-promote-actionwithmode: verify, which performs the promotion's checks and writes nothing. It fails when a staged image does not exist, or a release tag already holds different bits (on_conflict: 'fail', as the merge lane's promotion throughdocker-promote-actionrefuses it); an image already released with the same digest passes. Registries resolve as inmerge.yaml: a release-file override, else the input, with the image namespace between registry and name. The job loads the registry credential throughcredential-load-actionand checks out nothing, so no project code runs beside it. Without the two secrets, on a fork pull request for instance, it warns and the offline check stands alone.
The comparison is HEAD against its first parent. A Gerrit patch set
then compares with the commit it sits on, and a pull request's
default checkout, the merge commit GitHub prepares, with the target
branch, so every commit of the pull request counts. Leave ref
empty on pull requests: pinned to the head commit, the comparison
sees that commit's own changes alone. The has_release workflow
output reports whether the lane detected a release file. It can stay
'true' when that file then fails the offline or schema check, so
also require the workflow run to succeed before treating the file as
valid.
Adds to the shared inputs (repository, ref, checkout_submodules,
path_prefix, build_artifacts, images, select,
select_dependencies, build_timeout_minutes,
the five harden_runner_* inputs (see
Egress allow-list),
build_permit_egress_traffic, the gerrit_* inputs,
test_command/test_permit_fail,
lint_enabled/lint_permit_fail (and its deprecated
audit_permit_fail alias), sbom_enabled,
grype_enabled/grype_fail_on/grype_permit_fail/grype_cache_db,
grype_bypass_repository, and the five Grype policy inputs
grype_dependency_policy, grype_transitive_fail_on,
grype_only_fixed, grype_remediation_window_days and
grype_remediation_window_start (see
Dependency-change gating); a release
always gates, so grype_gate_when, grype_dependency_ecosystems and
grype_dependency_patterns do not apply):
| Input | Type | Default | Description |
|---|---|---|---|
platforms |
string | 'linux/amd64' |
Target platforms (csv); more than one engages QEMU + manifest lists |
ghcr_publish |
boolean | true |
Publish to GHCR as ghcr.io/<owner>/<name> (GITHUB_TOKEN) |
dockerhub_publish |
boolean | false |
Publish to Docker Hub as docker.io/<namespace>/<name> |
namespace_mode |
string | 'none' |
none, auto or manual; Docker Hub needs auto or manual |
namespace |
string | '' |
Namespace for manual; one component when publishing to Docker Hub |
registry |
string | '' |
Further registry as host[:port][/path], e.g. nexus3.onap.org:10002 |
registry_user |
string | '' |
Username override for registry; empty derives from the repository name |
push_latest |
boolean | false |
Move each image's latest at promotion, as latest_policy allows |
latest_policy |
string | 'highest' |
highest or always; see Moving latest |
dry_run |
boolean | false |
Run the lane without publishing: no push, release, promotion or tag |
attestations |
boolean | true |
SLSA build provenance per pushed image (by digest) |
sigstore_sign |
boolean | true |
Sigstore cosign keyless signature per pushed image (by digest) |
signature_format |
string | 'bundle' |
bundle (cosign v3 default) or legacy (sha256-<hex>.sig tag) |
One further input governs how hard signing failures land:
| Input | Type | Default | Description |
|---|---|---|---|
sigstore_sign_required_registries |
string | 'ghcr.io docker.io' |
Registries whose signing failures fail the release (* = all, '' = none) |
See Registry Capability for what the default list reflects and when to extend it.
With checkout_submodules set, the jobs that check out the validated
release tag resolve submodules at the commits recorded in that tag's
tree, so the release image holds submodule content at those commits.
Optional secrets: DOCKERHUB_USERNAME/DOCKERHUB_PASSWORD (the
Docker Hub leg skips with a warning when unset) and
OP_SERVICE_ACCOUNT_TOKEN/VAULT_MAPPING_JSON (the 1Password
credential for registry, keyed on the published repository's
name as in merge.yaml; that registry skips with a warning when
unset). The lane validates registry as merge.yaml validates its
registry inputs, through docker-promote-action's registry check,
which also requires a host Docker reads as one (with a . or a
port, or localhost) rather than as a Docker Hub namespace.
It refuses GHCR and Docker Hub hosts there (they have inputs of
their own), and logs in to its host[:port] in the build,
sign and promote-release jobs whenever they push or tag there.
Under the default harden_runner_egress: block the registry
host must be on the egress allow-list; see
Egress allow-list, or pass a
harden_runner_allowlist that permits it. A dry run lists, in the
build job's summary and the registry_plan output, the login and
pushes each requested registry would receive. Callers grant
contents: write, id-token: write, attestations: write,
artifact-metadata: write and packages: write. The
build_command escape hatch is absent from
this lane by design: project-tooling builds cannot produce
multi-platform manifests or per-registry digests reliably, so
repositories needing it release through merge.yaml.
artifact-metadata: write lets the provenance step create a storage
record for each GHCR image, labelled with the release tag, which
lists the image on the organisation's Linked Artifacts page
(https://github.com/orgs/<org>/artifacts). Storage records need
an organisation-owned repository: for a user-owned one the step
skips the record without a warning. A storage API failure after
the job starts logs a warning; the attestation succeeds either way.
Adds to the shared inputs (repository, ref, checkout_submodules,
path_prefix, build_artifacts, images, select,
select_dependencies, select_changed, namespace_mode, namespace,
build_command, build_command_images, build_timeout_minutes,
the five harden_runner_* inputs (see
Egress allow-list), build_permit_egress_traffic,
the gerrit_* inputs, test_command/test_permit_fail,
lint_enabled/lint_permit_fail (and its deprecated
audit_permit_fail alias), sbom_enabled,
grype_enabled/grype_fail_on/grype_permit_fail/grype_cache_db
and grype_bypass_repository):
| Input | Type | Default | Description |
|---|---|---|---|
snapshot_registry |
string | (none) | Required. Snapshot/staging registry, host[:port][/path], e.g. nexus3.onap.org:10003 |
release_registry |
string | (none) | Required. Release registry, host[:port][/path], e.g. nexus3.onap.org:10002 |
registry_user |
string | '' |
Registry username override; empty derives from the repository name |
nexus_user |
string | '' |
Deprecated alias for registry_user |
push_latest |
boolean | false |
Move each promoted image's latest too, as latest_policy allows |
latest_policy |
string | 'highest' |
highest or always; see Moving latest |
dry_run |
boolean | false |
Exercise the publish/promotion lanes without credentials or pushes |
tag_method |
string | '' |
'', latest, stream or yaml-file; see Tag methods |
tag_stream |
string | '' |
Stream name staged as the tag under tag_method: stream; required there |
grype_only_fixed |
boolean | false |
Count findings that have a fix alone; see Dependency-change gating |
grype_dependency_policy |
string | 'all' |
all or declared: which findings count against grype_fail_on |
grype_transitive_fail_on |
string | 'none' |
Inherited-package bar under declared; no effect on image SBOMs |
Outputs, each a job result (success, failure, cancelled or
skipped):
| Output | Description |
|---|---|
lint_result |
Dockerfile Lint; skipped when lint_enabled is false |
tests_result |
Tests |
sbom_result |
Image SBOM; skipped when sbom_enabled is false |
grype_result |
Grype Audit SBOM; skipped when grype_enabled or SBOM is off |
snapshot_publish_result |
Publish Snapshot; skipped when a gate did not pass |
release_publish_result |
Promote Release; skipped when the change has no release file |
Two more report the change scoping, as in build-test.yaml:
selection_reason (all, changed, shared or none) and, under
select_changed, changes_resolved (true or false).
snapshot_tags is a JSON array of every <registry>/<path>:<tag>
reference the snapshot publish pushed, or under dry_run would have
pushed, and stays empty when the publish did not run.
A failing lint, test, SBOM or Grype job blocks the snapshot publish
and nothing stages. The *_permit_fail inputs, or the
NO_BLOCK_AUDIT_FAIL repository variable, let staging go ahead
despite lint, test or Grype findings; SBOM generation has no such
input, so its failure always blocks. The image SBOMs stay on the run
for 45 days as the sbom-files-<build_id> artefact, next to the
Grype results.
The registry inputs take a host, an optional port and an optional repository path, which covers how the platforms in use address a repository:
nexus3.onap.org:10003 Nexus 3, repository on a port
acme.jfrog.io/docker-snapshot Artifactory, repository-path method
docker-snapshot.acme.jfrog.io Artifactory, subdomain method
The path belongs to the image reference, not the login: the workflow
authenticates to host[:port] and pushes to the full base, so one
credential covers every repository on an instance. Path components
take Docker's repository grammar — lowercase, runs of alphanumerics
joined by a single . or _, a doubled __, or one or more - —
because anything else fails when Docker or crane parses the
reference, and the input check exists to catch that before a publish
begins.
global-jjb's gerrit-docker-merge jobs publish one tag per image,
chosen by container-tag-method, and never read
version.properties. tag_method carries that choice over:
Jenkins container-tag-method |
merge.yaml inputs |
Method's tag |
|---|---|---|
| (not set) | tag_method: '' (the default) |
None: the LF tag set alone, as before |
latest (the Jenkins default) |
tag_method: latest |
latest |
stream |
tag_method: stream, tag_stream: <name> |
The job's stream name (master, london, ...) |
yaml-file |
tag_method: yaml-file |
The tag key of container-tag.yaml in the image's context |
git-describe |
Not supported | The lane refuses it |
A Jenkins job that sets no method uses latest, so migrate it with
tag_method: latest. With a method, an image stages under the
method's tag and, when version.properties holds a version, the LF
tag set after it, so release files naming either kind of tag keep
working. With a method and no version.properties, the method's tag
stands alone; with no method, version.properties stays
mandatory. yaml-file reads the file
docker-build-matrix-action
finds through its tag_files input: an images entry's tag_file,
else <context>/container-tag.yaml. An image without one gets the LF
tag set alone, and fails the publish when there is no version.
docker-tags-action
computes every tag; an image a build_command produced, which
discovery does not list, takes the tags every image shares. The
gerrit-validate job refuses an unknown tag_method, and stream
without a tag_stream that is a valid Docker tag, before anything
builds. push_latest and latest_policy are separate: they move
latest on the release registry at promotion, while tag_method: latest stages latest on the snapshot registry.
Addressing a registry is half the job: under the default
harden_runner_egress: block, the host must also appear in the
allow-list harden_runner_allowlist pins, and that list enumerates
hosts and ports rather than wildcards. Today it carries four JFrog
tenants at :443 — hyperledger, linuxfoundation, odpi and
zowe — alongside the Nexus 3 hosts at ports 10001-10004.
So a project on one of those tenants using the repository-path form
(for example linuxfoundation.jfrog.io/docker-local) needs no extra
setup, while these do:
- any other tenant, since there is no
*.jfrog.ioentry - the subdomain method, where each repository is a distinct host
(
docker-snapshot.acme.jfrog.io) and so a distinct entry - any port other than 443
In those cases extend the allow-list as below, or pass a
harden_runner_allowlist that permits the endpoint; otherwise the
publish fails at the network layer before the registry ever answers.
Preferring the repository-path form keeps the allow-list to one
entry per instance rather than one per repository.
All three lanes take the same five inputs and pass each one to harden-runner-block-action on every job:
| Input | Type | Default | Description |
|---|---|---|---|
harden_runner_egress |
string | 'block' |
block enforces the allow-list; audit logs egress without blocking it |
harden_runner_allowlist |
string | (pinned) | Baseline allow-list: the organisation list, pinned to a release |
harden_runner_supplemental_allowlist |
string | '' |
Further allow-list merged with the baseline, in the same grammar |
harden_runner_supplemental_unpinned |
boolean | false |
Let the supplemental list omit @ref and follow its default branch |
harden_runner_extra_endpoints |
string | '' |
Inline host[:port] tokens, space or newline separated, merged in |
A project whose organisation keeps its own list names that list as
the supplemental one, and keeps the baseline. A list in the
caller's own organisation may follow its default branch, so an ONAP
project picks up a new entry, such as registry.nordix.org, as soon
as it merges there:
with:
harden_runner_supplemental_allowlist: 'onap//'
harden_runner_supplemental_unpinned: trueA list in any other organisation has to carry an @ref commit SHA,
as the baseline does: the action refuses to follow another
organisation's branch, so nobody outside the caller's organisation
can widen its egress without a reviewed pin change.
Naming a supplemental list makes it mandatory. The lanes set the
action's supplemental_required whenever the input is non-empty, so
a list that does not resolve fails the job at the allow-list step,
not later at the first blocked connection.
harden_runner_extra_endpoints suits a short-term fix: a caller can
unblock a build the same day by writing the endpoint inline, for
example harden_runner_extra_endpoints: 'mirror.example.org:443'.
The lasting fix adds the endpoint to the organisation's list, after
which the inline token can go.
An unpinned list changes between runs, so the action records which
revision each run used: its supplemental_source and
supplemental_sha outputs name the list it loaded and the commit it
resolved, the audit trail for any later question about what a job
could reach.
A release file's container_pull_registry/container_push_registry
overrides may change the port or the repository path, but not the
host, because the promotion job authenticates there with the loaded
credential and an arbitrary host in a merged file could exfiltrate
it. Under Artifactory's subdomain method each repository is a
host, so overrides cannot move between repositories; use the
repository-path form where a release file needs that freedom.
Optional secrets: OP_SERVICE_ACCOUNT_TOKEN/VAULT_MAPPING_JSON
(the 1Password credential model shared across the workflow families;
the publish jobs skip with a warning when unset). The version comes
from version.properties at the project root (optional with a
tag_method), and release promotion
triggers on merged releases/ or .releases/ files with
distribution_type: container (the LF self-release container
schema, including its optional container_pull_registry/
container_push_registry overrides).
The check-release job detects and validates the release file with
docker-release-detect-action,
then checks the file it found against the release container schema
with
verify-release-schema-action,
as Jenkins does at merge too: a file can merge without a verify run,
and one failing the schema fails the job and promotes nothing.
It compares the merged commit with its first parent alone, so a merge
commit counts the release files it brings in, never one the
target branch already held. It fails rather than skipping when the
checkout is too shallow to hold that parent (the job fetches depth
2), when a commit adds more than one container release file, or when
a file breaks Docker's name or tag grammar. The lane keeps the
action's default numeric_versions: literal, taking an unquoted
numeric version as written (version: 1.10 stays 1.10); quote
versions to be sure. The action needs python3 3.10 or later and mikefarah yq
v4.25.3 or later, both present on GitHub-hosted runners.
The release-publish job promotes with
docker-promote-action,
which reads every staged image and every release tag before it
writes anything, then copies by digest with crane copy:
- a release tag already holding the staged digest is skipped, so a re-run or a second merge of the same release file copies nothing again;
- a release tag holding a different digest fails the job before
writing any image, because release tags are immutable (the lane
sets the action's default
on_conflict: fail); release under a new tag instead; - a missing staged image fails the job before writing any image;
latest(push_latest) moves once every image has released, and not before, aslatest_policyallows: by default, never for an image whose repository holds a higher release (see Movinglatest). Promotion runs one release at a time per repository, across branches and alongside the release lane, so two release files merging at once cannot move it back.
The step summary lists each image with its source, destination,
digest and status. The action logs in to each registry's
host[:port] with the loaded credential, in a docker config private
to the step, and downloads a pinned, checksum-verified crane from
GitHub releases, so a custom harden_runner_allowlist must permit
github.com and release-assets.githubusercontent.com. A dry run
prints the plan without downloading, logging in or reading a
registry.
Nothing moves latest unless push_latest is true. With it set,
latest_policy decides, per image, whether latest moves to this
release, in both publishing lanes. The release lane applies the same
rule to the repository's Latest GitHub release, whatever
push_latest says.
highest(the default) moveslatestwhen the release is a SemVer release at least as high as every release version already there, and never otherwise: the release tags in that image's repository for an image, the repository's published releases (drafts and pre-releases excluded) for the Latest GitHub release. A patch on an older line (1.2.5 after 2.0.0), or a re-run or re-promotion of an old release, leaveslatestin place. A leadingvmakes no difference, build metadata does not count, the rule skips tags that are not SemVer (X.Y-STAGING-latest,sha256-…signature tags and the like), pre-releases never move it, and a release equal to the highest does, so re-running the highest release converges. A first release always moves it.alwaysmoveslatestfor any release, older ones included, with a warning. Reserve it for pointinglatestback on purpose. In the release lane, a re-run of a release already published marks it the Latest GitHub release too, so the release and the images agree.
Any other value fails the gerrit-validate job before anything
writes. Images move through
docker-promote-action,
which reads each image's tags with crane ls; the release lane's
promote-release job decides the Latest GitHub release itself.
That job runs one release at a time per target repository, in a
concurrency group with queue: max that the merge lane's promotion
and snapshot publish share, so a run for another tag cannot publish
between a decision and the write it makes, and GitHub keeps waiting
releases in the queue (up to 100) instead of cancelling them. Where registries
overlap, so one image repository appears twice among the pushed
images, docker-promote-action collapses the duplicates and moves
that repository's latest once. It refuses two different digests
for one repository, and the job fails before the release
publishes. After marking a release Latest, and on a re-run of a
release already published, the job reads the published releases
and the repository's Latest release again and, if a higher release
than Latest has published (by hand, from another repository's
caller, or by an earlier attempt that failed after publishing),
hands Latest to that release. If higher releases keep publishing
through five such moves, the job fails before any image latest
moves. Each writes its decisions to the step summary, and a release
lane dry run reports the Latest GitHub release decision in its
promotion plan.
jobs:
build-test:
permissions:
contents: read
pull-requests: read
# yamllint disable-line rule:line-length
uses: lfreleng-actions/docker-workflows/.github/workflows/build-test.yaml@<SHA> # vX.Y.ZPin the uses: reference to the commit SHA of a docker-workflows
release. Never use a mutable ref such as @main, which follows
whatever lands upstream without review. See examples/build-test/
for complete callers.
For projects where Gerrit serves as the source of truth,
gerrit_to_platform dispatches caller workflows through
workflow_dispatch with nine GERRIT_* inputs. The naming contract
requires the verify caller filename to contain both gerrit and
verify (for example gerrit-verify.yaml). See the gerrit.yaml
variant under examples/build-test/, including vote/comment
plumbing.
The merge and release callers publish, so their workflow-level
concurrency block must neither drop a pending run nor cancel one in
progress. Without queue, GitHub keeps one pending run per group and
a newer run replaces it, skipping any container release file that
run would have promoted.
- Merge callers (
examples/merge/): group per branch, so the rollingSNAPSHOT-latest/STAGING-latesttags cannot regress, withcancel-in-progress: falseandqueue: max. - Release callers (
examples/build-test-release/): group per tag, withcancel-in-progress: falseandqueue: max, so re-pushing a tag never cancels a release that is already publishing.
queue: max keeps up to 100 pending runs, first in, first out. The
workflows themselves serialise release promotion and the latest
move per target repository, across both lanes, so callers need no
repository-wide group. tests/test_example_concurrency.sh pins these
settings in the examples.
.github/workflows/testing.yaml exercises build-test.yaml on pull
requests against pinned fixture releases:
test-docker-project
(single image under docker/) and
test-docker-monorepo
(three images with a same-repository FROM chain), covering
auto-discovery, explicit image lists with per-image build arguments,
image namespacing, image selection, the build_command escape hatch
and the test_command hook. The two selection legs assert the exact
set of images built: chain-child brings in its base-alpine base,
and util-echo with select_dependencies: false builds alone.
tests/test_image_select.sh checks every lane declares select and
select_dependencies alike and passes both to discovery, and runs
the gerrit-validate step that refuses select with
build_command, and select_changed with either. A further call
sets select_changed on the monorepo fixture at a tag, whose HEAD
is not the run's commit, so the diff cannot resolve: its test
command requires every image built, and a follow-on job requires
the lane to report the diff unresolved and the selection all.
Selection by a resolved diff runs on tests/fixtures/select-changed
at the run's own commit: select-child builds from select-base,
and select-leaf stands alone. One call makes the leaf read every
path, so it builds alone; another makes the base read every path, so
it builds with its child; and discovery calls in the verify and
merge lanes select the images the change touched, none when it
leaves the fixture alone. An empty diff, from commits that cancel
out, gives every call nothing to match, so each selects none.
tests/select_changed_oracle.sh predicts
each selection from the same diff, each call's test command
requires the images it predicts, and a follow-on job requires every
call to report the diff resolved with the predicted reason, and the
merge lane's tests and snapshot publish to skip on an empty
selection and run otherwise.
tests/test_change_selection_wiring.sh checks the rest of the
select_changed wiring in the verify and merge lanes: the
changed-paths step ahead of discovery, the checkout depth, the
changed_files mapping, the report step on resolved and unresolved
diffs, the empty-selection skip, both lanes' selection outputs, its
absence from the release lane, both actions' pins by agreement and
version floor, the resolved calls' wiring, and the oracle on fixed
diffs. A further
call checks out the monorepo commit
that adds a release descriptor, with the release registries set, and
a follow-on job requires the lane to report that file detected.
tests/test_verify_release.sh covers the rest of the release-file
checks: valid and malformed release files against
docker-release-detect-action, and docker-promote-action in verify
mode against a fake crane, each at the commit the lane pins.
tests/test_release_schema.sh checks both lanes run
verify-release-schema-action after detection, on detection's
release_file, and gate the jobs after it on check-release
passing; it then runs both actions' checks at their pinned commits
on a valid .releases/ file, files detection accepts and the schema
rejects, and a change adding a file in each directory.
A further build-test.yaml call sets grype_gate_when: 'dependencies-changed', and a follow-on job requires the gate to
stay active with the reason that the dependency-change signal was
unavailable, which a fixture checked out at a tag guarantees; that
proves the verdict travelled from repository-metadata to the scan.
A job runs the lanes' validator itself, grype-scan-action at their
pin in its check-and-stop mode with build-test.yaml's defaults and
a gate-when the action does not know, and requires the step to fail:
a call to a lane with a bad input would fail the run, so this proves
the rejection without one.
tests/test_dependency_change.sh, run as
bash tests/test_dependency_change.sh, checks each lane declares
its Grype inputs with their defaults and passes each to the scan,
checks the gerrit-validate step that validates them through
grype-scan-action against the scan it mirrors (one pin, the same
expression for every input the scan passes, the check-and-stop mode
on, and each breach of that on a copy of the workflow failing), runs the
ecosystems check against valid and invalid values, checks the
detection wiring in repository-metadata
and the verdict's path to the scan in build-test.yaml, runs the
step that resolves the detection scope (the docker preset joined
to the caller's, custom Dockerfile names turned into patterns, the
scope widened for a recipe,
context or named build context outside path_prefix, and detection
skipped for a name no pattern can express or a build_command), runs
the action at its pinned commit against a scratch repository to show a
Dockerfile with a custom name, in or beside path_prefix, goes
unnoticed until those
patterns reach it and that a caller's grype_dependency_patterns
count after them, and runs the resolved self-test's verdict check
against the action to show both read the same recipes.
build_artifacts runs end to end too: one job uploads
target/hello.txt, and a build-test.yaml call that needs: it
builds tests/fixtures/build-artifacts/, whose Dockerfile copies
that file, then reads it back out of the image in test_command. A
second pair does the same with a packed artefact:
build-artifact-action packs hello.txt, and the lane call passes
the id and digest it reports, with a path of target.
tests/test_build_artifacts.sh checks the three lanes define the
input and its steps alike, checks each unpack step passes no run ID
or token and unpacks with overlay, and runs the validation,
placement, prepare and rollback step scripts from each lane, with a
stand-in for the unpack, against every failure case and the no-op
inputs.
The same build_artifacts call, in block mode, also passes the
three allow-list extension inputs: the organisation's own list as an
unpinned supplemental list and github.com:443 as an inline
endpoint. Both duplicate entries the baseline already carries, so
the call grants nothing new but proves the lane forwards each
input.
Both publish lanes are also self-tested, under dry_run. Neither
publishes: they build, audit and test the fixture images, then
report the tags, assets and promotion a real run would produce.
merge.yaml runs against the fixture commit that adds a release
descriptor, and build-test-release.yaml against its signed v0.1.0
tag, so tag validation applies at full strength. A second merge leg
switches lint, SBOM and Grype off, and a final job reads the gate
and publish results merge.yaml reports as workflow outputs. It
checks that the gates ran or skipped as configured and that the
snapshot publish and release promotion ran in both legs, because a
wrongly skipped job still shows green. A failing gate cannot run in
the self-test without failing it, so tests/test_merge_gating.sh
covers that case: it evaluates the publish condition from
merge.yaml over every combination of gate results and toggles, and
checks that no failed or cancelled gate admits a publish. A further
build-test-release.yaml leg plans a Nexus 3 registry with GHCR
off, and a follow-up job asserts its registry_plan output.
tests/test_latest_policy.sh checks that both lanes refuse a bad
latest_policy and hand it to docker-promote-action, and runs the
release lane's Latest GitHub release decision against a stub gh.
All three lanes check their registry inputs through
docker-promote-action's registry check, so they accept and refuse
the same hosts; the action's own suite tests that rule, and
tests/test_registry_wiring.sh checks each lane calls it at the
shared pin with its registry inputs, before anything writes. The
action skips an empty registry and strips surrounding whitespace
before its check, so each lane's own bash check runs ahead of it:
merge.yaml's requires both registries, and every lane refuses
whitespace or a character outside printable ASCII, since the lanes
use the value as given; the wiring test runs merge.yaml's check.
A dry run cannot reach the behaviour that appears after images push: cosign signing, SLSA provenance, per-registry digest capture, the crane promotion itself, and multi-platform manifest assembly, which needs a registry to hold the list. Instantiating repositories still prove those through their own release and merge cycles.
The single-platform digest capture is also tested in isolation:
tests/test_release_digest.sh runs the release lane's version and
registry steps, extracted from the workflow, and then the build
action at the commit the lane pins, against a fake docker. It
checks that the steps feed the action the right tags and
repositories, the registry input's login and dry-run plan
included, that the registry input's lane-specific check refuses
GHCR, Docker Hub, whitespace and a registry_user without a
registry, and that each pushed repository resolves its own digest, Docker Hub's
and a port-addressed registry's included.
One consequence worth knowing before calling build-test-release.yaml
with dry_run, self-test or otherwise: GitHub checks a called
workflow's job permissions against the caller's grant before any job
starts, and rejects the whole run when the callee asks for more.
Because permissions: takes no expression, the lane's declarations
cannot shrink for a dry run, so a caller must grant contents,
packages, id-token, attestations and artifact-metadata write
even though a dry run uses none of them. A caller missing any of
them fails at startup (startup_failure) before a job runs.
merge.yaml needs no more than contents: read,
because it authenticates to registries with a loaded credential
rather than GITHUB_TOKEN.