Closed KPLauritzen closed 2 years ago
Hi @KPLauritzen
This has now been fixed by feeding the error back to Azure DevOps when a non-zero exit code is detected:
- task: Bash@3
inputs:
targetType: inline
script: |
echo 'Checking for required authentication variables...'
bash -c '[[ -z $AWS_PROFILE || -z $SAML2AWS_ROLE || -z $SAML2AWS_PASSWORD || -z $SAML2AWS_USERNAME ]] && exit 1 || true'
if [[ $? -ne 0 ]]; then
echo 'Some environment variables are not set or they have empty values...'
exit 1
fi
displayName: Testing environment variables
Template has been updated accordingly.
There is a step in the sample azure pipeline where you are checking if the required variables are available. See https://github.com/dfds/ado-deployment-templates/blob/e9b6b1c1374cfa650b673d694d629122861d497e/ASP.NET%20Core%20sample/azure-pipelines/azure-pipelines.yaml#L37
That does not work. I have made a minimal pipeline with that step and no env variables present. See https://dfds.visualstudio.com/Smart%20Data/_build/results?buildId=399157&view=logs&j=c2c68960-4438-5f02-6a48-42e214c5aa43&t=922c0c65-55f5-5296-e6a9-03d3274dfca1
The command
bash -c '[[ -z $AWS_PROFILE || -z $SAML2AWS_ROLE || -z $SAML2AWS_PASSWORD || -z $SAML2AWS_USERNAME ]] && exit 1 || true'
works as intended if I run it in my local bash terminal.