I am using an azure-pipelines.yml script to source control my build pipeline.
In a task I have defined a bash script to set some variables for certificates paths depending on whether we are building for production or anything else:
steps:
- bash: |
echo "Building for $BUILD_SOURCEBRANCHNAME"
if [ "$BUILD_SOURCEBRANCHNAME" = "production" ]; then
echo "##vso[task.setvariable variable=configuration]Release"
echo "##vso[task.setvariable variable=certificatesPath]${{ parameters.productionCertificatesPath }}"
else
echo "##vso[task.setvariable variable=configuration]Staging"
echo "##vso[task.setvariable variable=certificatesPath]${{ parameters.stagingCertificatesPath }}"
fi
name: environmentVars
How can I then access these variables in an expression in a later build step in the same job? I know I can access them like $(environmentVars.configuration) and $(environmentVars.certificatesPath), but this syntax doesn't work for expressions. Here is where I'm trying to access the variables:
signingProvisioningProfileFile: ${{ format('{0}/app.mobileprovision', <ACCESS VARIABLE HERE>) }}
signingProvisioningProfileFile? Is that a build step parameter, or part of a Bash script?$(configuration)and$(certificatesPath). If it's in another stage in the yaml file you'll need to useisOutput=trueon yourtask.setvariable