Skip to content

Handle 'outputs' in workflows, providers, and generators

Current situation

There is no proper support for outputs in workflows and generator jobs, and for provider jobs, there is only limited support (the elements in the plugin descriptors are ignored).

Desired outcome

When creating generator and provider plugins, it should be possible to define an 'outputs' section in the descriptors.

Also, it should be possible to define an outputs section in a workflow:

metadata:
  name: Using outputs from a previous job
jobs:
  job1:
    runs-on: linux
    # Map a step output to a job output
    outputs:
      output1: ${{ steps.step1.outputs.test }}
      output2: ${{ steps.step2.outputs.test }}
    steps:
    - id: step1
      run: echo "::set-output name=test::hello"
    - id: step2
      run: echo "::set-output name=test::world"
  job2:
    runs-on: linux
    needs: job1
    steps:
    - run: echo ${{needs.job1.outputs.output1}} ${{needs.job1.outputs.output2}}
outputs:
  foo: ${{ jobs.job1.outputs.output1 }}
  bar: ${{ jobs.job2.result }}

If the execution is successful, the WorkflowCompleted event includes an outputs section:

- apiVersion: opentestfactory.org/v1
  kind: WorkflowCompleted
  metadata:
    creationTimestamp: '2024-08-21T23:35:46.409838'
    name: Using outputs from a previous job
    namespace: default
    workflow_id: e79388b2-2142-4949-859b-94b02a9d7bde
  outputs:
    bar: success
    foo: hello

If an error occurred while evaluating an output, its value will be could not evaluate expression, got: ....

If the workflow execution was not successful, the WorkflowCanceled event also includes an outputs section.

There is no outputs section in WorkflowCompleted or WorkflowCanceled if there is no outputs section in the workflow.

Edited by Martin Lafaix