Reputation: 1026
I'm building a multi-stage pipeline in which my build stage stores a single file as a pipeline artifact. In the deployment stage the artifact is automatically download and I need the name of the file in order to proceed with the following steps.
Currently, I'm publishing as a variable the name of the file stored as the artifact of the build. I'm wondering if the download
task would be able to provide the name of the file so that I can further decouple the build and deploy stages.
This is what I'm using right now:
- bash: |
jarFile=`ls -1 *.jar`
echo "##vso[task.setvariable variable=jarFile;isOutput=true]${jarFile}"
workingDirectory: target
name: mavenTarget
displayName: Finds name of built `.jar` file
And then in the deployment stage:
variables:
- name: jarFile
value: $[ stageDependencies.ci.build.outputs['mavenTarget.jarFile'] ]
Upvotes: 0
Views: 225
Reputation: 35109
I'm wondering if the download task would be able to provide the name of the file so that I can further decouple the build and deploy stages.
I am afraid that the Download build artifacts task has no built-in output variable that can represent the name of an artifact or the files in the Artifact.
The output variable of the download artifacts task is XXX.buildnumber
. It doesn't contain the info about Artifacts Name or the files in Artifacts.
The cross-stage variables used in your Current YAML is an efficient way. You can continue to use the method.
Upvotes: 1