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'] ]