[英]Azure DevOps - pipeline variables - special char issue $$
I am using DevOps pipeline to build and deploy to different environments我正在使用 DevOps 管道构建和部署到不同的环境
For one environment I am encountering this issue where i am using a Pipeline Variable with $$ in the value对于一个环境,我遇到了这个问题,我正在使用价值 $$ 的管道变量
For Example: Password pipeline variable with value = $omeCla$$Password
例如:密码管道变量,值为
$omeCla$$Password
When i deploy it fails and when i check the logs the password is displayed as $omeCla$Password.当我部署失败时,当我检查日志时,密码显示为 $omeCla$Password。 So basically when $$ are together it drops one $
所以基本上当 $$ 在一起时它会掉落一个 $
For all variable i am using regex __VaraibleValue__
and its working fine对于所有变量,我使用正则表达式
__VaraibleValue__
并且它工作正常
I have tried:我试过了:
$omeCla$\$Password
to try and escape and it displays as $omeCla$\$Password
. $omeCla$\$Password
尝试逃逸,它显示为$omeCla$\$Password
。 So basically \ doesn't work.所以基本上 \ 不起作用。 I tried
'$omeCla$$Password'
to try and escape and it displays as '$omeCla$Password'
我尝试
'$omeCla$$Password'
进行逃逸,结果显示为'$omeCla$Password'
I want to keep this value as a normal pipeline variable before review我想在审查之前将此值保留为普通管道变量
So basically how can I escape this?所以基本上我怎么能逃避这个?
Or should I add a Secret Token here in the replace token task (see screenshot below)?或者我应该在替换令牌任务中添加一个秘密令牌(见下面的截图)? and then make the pipeline variable secret?
然后使管道变量保密? If so, what should I set for Secret Token?
如果是这样,我应该为 Secret Token 设置什么? Also, in app.config in my repo what should I use instead of the regex
__VariableName__
that I use for normal variables?另外,在我的 repo 的 app.config 中,我应该使用什么来代替我用于普通变量的正则表达式
__VariableName__
?
The solution was to use 4 $.解决方案是使用 4 $。 So if you have $$ together you need to add $$$$
所以如果你有 $$ 在一起,你需要添加 $$$$
Example: $someCla$$$$Password示例:$someCla$$$$密码
@JaneMa-MSFT as requested @JaneMa-MSFT 根据要求
https://developercommunity.visualstudio.com/content/problem/1296808/azure-pipeline-how-to-escape-special-characters-in.html https://developercommunity.visualstudio.com/content/problem/1296808/azure-pipeline-how-to-escape-special-characters-in.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.