Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting pipeline variable contains extraneous double or single quote

I have the following command to set a BASE_URL variable in Azure DevOps yaml:

- script: |
    echo "##vso[task.setvariable variable=BASE_URL;]$(PROD-CONTAINER-URL)"
  condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))

However whenever I echo the variable then it looks like this:

https://google.com"

If I replace it with a single quote or put the $(PROD-CONTAINER-URL) inside or outside the quotes then the problem still persists. How can I get around this and what causes it?

like image 335
uioporqwerty Avatar asked Dec 06 '25 21:12

uioporqwerty


1 Answers

Just as in kap's answer, I saw the same behavior this week and resolved by turning off bash debugging around the variable output lines, for example:

set +x
echo "##vso[task.setvariable variable=BASE_URL;]$(PROD-CONTAINER-URL)"
set -x
like image 164
Gary Swalling Avatar answered Dec 08 '25 11:12

Gary Swalling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!