'Azure DevOps removes double quotes
I am using a powershell script to create some build variables.
Write-Host "##vso[task.setvariable variable=$secret;issecret=true]$($keyvaultSecret)"
When I try to use those in a HelmDeploy task it fails with the following error.
[..]/helm upgrade --namespace dev-namespace --install --wait --atomic --set ImageTag=<acr name>.azurecr.io/<image name> [...] --set mySting2=*** [...] --set-string myString=test123'456
Error: "helm upgrade" requires 2 arguments
Usage: helm upgrade [RELEASE] [CHART] [flags]
##[error]Error: "helm upgrade" requires 2 arguments
From the error message I can see that most of the values are handled correctly as a secret. Only the myString variable is visible and is different than the original supplied value. So I guess that might be the reason for the error.
The original values has a double quote in it, like this:
test"123'456
But for some reason is seems to be removed.
Does anyone got an idea how to fix this behavior?
Solution 1:[1]
Looks like you're passing these in through the additional arguments line. Unfortunately, you need to supply your own string there complete with the correct escapes and quoting. having a password with quotes, % or & can be problematic in those scenarios. It's up to you to properly escape values in the additional arguments line based on the default shell of the operating system you're on.
You could escape the quote when setting the variable, doing a
-replace "`"", "`"`""
before setting the value in PowerShell may work.
Or you can try passing the value as an environment variable on the task and then referencing that from the Additional Arguments.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |


