本文介绍了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值替换.而且,目前无法关闭 .

UPDATEI 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.

推荐答案

根据该票证中的评论 https://issues.jenkins-ci.org/browse/JENKINS-16143

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

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

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

08-19 08:41