I added the custom variable like this:
- task: Bash@3
displayName: 'naming the artifact'
inputs:
targetType: 'inline'
script: |
an=FE_SNAPSHOT.zip
echo "##vso[task.setvariable variable=artifactName;]$an"
Now I am inside the deploy pipeline and would like to access the variable artifactName
in a deploy bash script.
The variable is not listed in the "Initialize Job" step.
UPDATE 1: The deployment pipeline has a trigger to the build pipeline and the build pipeline is linked as an artifact (in the artifacts section). Maybe this is another problem...
SOLUTION: The linked ticket contains a part of my solution. The BUILD PIPELINE creates a simple file containing the value/variable I want to store:
- task: Bash@3
displayName: 'naming the artifact'
inputs:
targetType: 'inline'
script: echo "FE_SNAPSHOT.zip" > $(Build.ArtifactStagingDirectory)/artifactName.value
The DEPLOYMENT PIPELINE reads the file and sets the variable:
- task: Bash@3
displayName: 'naming the artifact'
inputs:
targetType: 'inline'
script: |
an=`cat FE_CI_OS/drop/artifactName.value`
echo "##vso[task.setvariable variable=artifactName;]${an}"
Then it can be used in a next task as $(artifactName)
.