Jenkins文本参数-特殊字符乱码(不需要的变量替换) [英] Jenkins text parameter - special characters garbled (unwanted variable substitution)

查看:1104
本文介绍了Jenkins文本参数-特殊字符乱码(不需要的变量替换)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jenkins(在Linux下)工作,使用构建参数类型为文本".我使用参数来形成在构建过程中使用的文件内容,并使用bash的"shell执行"步骤,如echo "$TEXTPARAM" > file.

I have a job in Jenkins (under Linux) with build parameter of type "Text". I use the parameter to form contents of a file which is used in build process, with bash "shell execute" step like echo "$TEXTPARAM" > file.

如果有通用文字,效果很好.但是,当出现"$"之类的字符时,它的行为会很奇怪.

It works quite well if there is general text. But when characters like "$" appears - it behaves strangely.

E. G.文字

Some $one and $$two and $$$more bucks and $ bucks $$ that $$$ stand alone and$ after$$ words$$$

被转化为

Some $one and $two and $-sl bucks and $ bucks $ that $$ stand alone and$ after$ words$$

尽管我希望文本显示在文件中,就像在输入文本框中显示一样.

though I want the text to appear in file just as it appears in input textbox.

这是詹金斯(Jenkins)中的错误(所以我应该将问题发布到他们的跟踪器上)还是我做错了什么?

Is it a bug in jenkins (so I should post an issue to their tracker) or am I doing something wrong?

更新 我想这是由于詹金斯所做的变量替换.也就是说,在执行任何"shell执行"步骤之前,所有$VARNAME都将用VARNAME值替换.而且,目前无法关闭 .

UPDATE I suppose that is due to variable substitution done by Jenkins. I.e all $VARNAMEs are substituted by VARNAME values prior to any "shell execute" steps are executed. And this substitution cannot be turned off as for now.

推荐答案

根据该票证中的评论

这似乎不是错误.比较参数值$ JENKINS_URL和$$ JENKINS_URL. Jenkins在内部解析变量中的占位符, 和美元用于此. $$是转义的$.

This appears to not be a bug. Compare the parameter values $JENKINS_URL and $$JENKINS_URL. Jenkins internally resolves placeholders in variables, and dollars are used for that. $$ is an escaped $.

我在Jenkins ver.上对字符串和文本字段观察到相同的行为. 1.562

I am observing the same behavior for string and text fields on Jenkins ver. 1.562

这篇关于Jenkins文本参数-特殊字符乱码(不需要的变量替换)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆