jobs.<job_id>.outputs

1 minute read
On this page

Map outputs for a job with jobs.<job_id>.outputs. All jobs that depend on this job to run also have these outputs available to them.

outputs specifications:

  • Enter outputs as Unicode strings up to 4 kB maximum.

  • The total of all outputs in a workflow is not to exceed 1 MB.

  • If an output contains a secret, it is redacted and not sent to CloudBees.

  • Job outputs mapping is evaluated at the end of the job.

Example usage

In the following example:

  • Step output is mapped to the my-job-1 output.

  • The my-job-1 outputs are used in my-job-2, due to the needs keyword, which renders my-job-2 dependent on successful completion of my-job-1 to run.

jobs:
  my-job-1:
    outputs:
      output1: ${{ steps.step1.outputs.greeting }}
      output2: ${{ steps.step2.outputs.greeting }}
    steps:
      - name: My first step
        uses: docker://alpine:3.18
        id: step1
        run: echo "hello there" > "$CLOUDBEES_OUTPUTS/greeting"
      - name: My second step
        uses: docker://alpine:3.18
        id: step2
        run: echo "from the hive" > "$CLOUDBEES_OUTPUTS/greeting"
  my-job-2:
    needs: job1
    steps:
      - env:
          OUTPUT1: ${{needs.job1.outputs.output1}}
          OUTPUT2: ${{needs.job1.outputs.output2}}
        uses: docker://alpine:3.18
        run: echo "$OUTPUT1 $OUTPUT2"