argo-workflows
argo-workflows copied to clipboard
Unable to resolve output artifact of steps from expression when it refers to its own input artifact
Summary
I'm trying to assign an output artifact of steps using fromExpression
. When the expression contains reference of an input artifact of the same steps, Argo fails to resolve it. Interestingly, using from
instead of fromExpression
works.
Diagnostics
The smallest workflow that reproduces the bug
kind: Workflow
metadata:
generateName: from-expression-bug-
spec:
entrypoint: main
arguments:
artifacts:
- name: foo
raw:
data: |
Hello
templates:
- name: main
inputs:
artifacts:
- name: foo
steps:
- - name: hello
inline:
container:
image: alpine:latest
outputs:
artifacts:
- name: result
# a trivial expression here only for reproducing the bug
fromExpression: "1 == 1 ? inputs.artifacts.foo : inputs.artifacts.foo"
When the workflow is submitted, the steps becomes error with message:
unable to resolve outputs from scope: Variable {{&Artifact{Name:result,Path:,Mode:nil,From:,ArtifactLocation:ArtifactLocation{ArchiveLogs:nil,S3:nil,Git:nil,HTTP:nil,Artifactory:nil,HDFS:nil,Raw:nil,OSS:nil,GCS:nil,},GlobalName:,Archive:nil,Optional:false,SubPath:,RecurseMode:false,FromExpression:1 == 1 ? inputs.artifacts.foo : inputs.artifacts.foo,ArtifactGC:nil,Deleted:false,}}} is not an artifact

While the workflow using from
instead of fromExpression
kind: Workflow
metadata:
generateName: from-expression-bug-
spec:
entrypoint: main
arguments:
artifacts:
- name: foo
raw:
data: |
Hello
templates:
- name: main
inputs:
artifacts:
- name: foo
steps:
- - name: hello
inline:
container:
image: alpine:latest
outputs:
artifacts:
- name: result
from: "inputs.artifacts.foo"
will not encounter the error.
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
@zjgemi Hello, what is your use case for these artifacts in this scope?
@zjgemi Hello, what is your use case for these artifacts in this scope? In my case I have a conditional step. If the step is not skipped, the next step uses its output artifact, otherwise the next step uses my input artifact directly. Due to conditional artifacts only supported when assigning output artifacts, I construct a steps template to do this.
@dpadhiar we need to include the input.artifacts
in scope
@sarabala1979 Will do.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.
This issue has been closed due to inactivity. Feel free to re-open if you still encounter this issue.