CICD-030 · Pass an output across jobs
Encyclopedia · Variables, outputs and data flow · All snippets
Previous · CICD-029 · Next · CICD-031
1. Where it fits
- Placement Inside the consumer job. Declare a
digestoutput on an upstream job with the IDbuild. - Prerequisites GitHub Actions job or equivalent Gitea version with environment file support.
- Platforms github-actions, gitea-actions.
- Parameters
DIGEST.
2. Copy the snippet
yaml
needs: build
steps:
- env:
DIGEST: ${{ needs.build.outputs.digest }}
run: test -n "$DIGEST"3. How it works
The build job must declare a digest output. needs exposes that value as metadata to this consumer, which maps it to DIGEST and fails when it is empty.
The consumer receives a declared digest output across the job boundary.
flowchart TD N1["Build image"] N2["Producer step output"] N1 --> N2 N3["Build job output"] N2 --> N3 N4["Consumer digest check"] N3 --> N4 N5["Build job result"] N5 --> N4
4. Verify the result
Declare digest in the producer's job outputs and distinguish it from a missing artifact.
Validation syntax-validated (YAML parse). Status definitions.