-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[github] support jobs.<job_id>.outputs
#43
Comments
Example v0 pipeline with outputs referenced in a step and following stage: stages:
- stage:
name: first
identifier: first
description: ""
type: CI
spec:
cloneCodebase: false
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: one
identifier: one
spec:
shell: Sh
command: export SOMEVAR=somevalue
outputVariables:
- name: SOMEVAR
- step:
type: Run
name: two
identifier: two
spec:
shell: Sh
command: |-
# both of these return the output
echo <+steps.one.output.outputVariables.SOMEVAR>
echo <+execution.steps.one.output.outputVariables.SOMEVAR>
- stage:
name: second
identifier: second
description: ""
type: CI
spec:
cloneCodebase: false
platform:
os: MacOS
arch: Arm64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: one
identifier: one
spec:
shell: Sh
command: echo <+pipeline.stages.first.spec.execution.steps.one.output.outputVariables.SOMEVAR> |
Here is an equivalent use of outputs from this documentation https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idoutputs stages:
- stage:
name: job1
identifier: job1
description: ""
type: CI
spec:
cloneCodebase: false
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: step1
identifier: step1
spec:
shell: Sh
command: export OUTPUT1=hello
outputVariables:
- name: OUTPUT1
- step:
type: Run
name: step2
identifier: step2
spec:
shell: Sh
command: export OUTPUT2=world
outputVariables:
- name: OUTPUT2
- stage:
name: job2
identifier: job2
description: ""
type: CI
spec:
cloneCodebase: false
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: echo
identifier: echo
spec:
shell: Sh
command: echo $OUTPUT1 $OUTPUT2
envVariables:
OUTPUT1: <+pipeline.stages.job1.spec.execution.steps.step1.output.outputVariables.OUTPUT1>
OUTPUT2: <+pipeline.stages.job1.spec.execution.steps.step2.output.outputVariables.OUTPUT2> |
I started to work on this in https://github.com/drone/go-convert/compare/issue43 I have a test that currently fails. The tricky part is that we need to take this: outputs:
output1: ${{ steps.step1.outputs.test }}
output2: ${{ steps.step2.outputs.test }} And use those values to add the necessary steps:
- id: step1
spec:
run: echo "test=hello" >> "$GITHUB_OUTPUT"
outputs:
- test
type: script
- id: step2
spec:
run: echo "test=world" >> "$GITHUB_OUTPUT"
outputs:
- test NOTE: The above still won't work as-is, the variables have to be exported for Harness CI's outputs to pick them up. The I think we can wait on converting the references to outputs like these - env:
OUTPUT1: ${{needs.job1.outputs.output1}}
OUTPUT2: ${{needs.job1.outputs.output2}} These would have to convert to this - env:
OUTPUT1: <+pipeline.stages.job1.spec.execution.steps.step1.output.outputVariables.test>
OUTPUT2: <+pipeline.stages.job1.spec.execution.steps.step2.output.outputVariables.test> |
A map of outputs for a job. Job outputs are available to all downstream jobs that depend on this job.
See
The text was updated successfully, but these errors were encountered: