我对詹金斯的工作。 我已经建立了秘密文本JOB1:用户名和密码变量Ant属性值作为参数变量在JENKINS
APP1_Dev_password
,并使用来自我的Ant脚本这个变量通过发送预定参数这个变量来我的其他作业2。我访问这个变量使用
<property name="DBPassword" value="${APP1_Dev_password}"/>
这很好。 但我的蚂蚁脚本是我的所有应用程序的单一通用脚本。 所以我必须得使用
<property name="constructPasswordVariable" value="${APPLICATIONNAME}_${ENVIRON}_password"/>
<echo message= "constructPasswordVariable: ${constructPasswordVariable}" />
从我的ant脚本自动构建这个APP1_Dev_password字符串这清楚地打印我constructPasswordVariable为APP1_Dev_password。 现在我必须使用constructPasswordVariable属性的这个值作为从job1中获取的变量。
<echo message= "PasswordValue: ${${constructPasswordVariable}}" />
该声明失败。你能指导我如何处理这个问题吗?
SOLUTION
<property name="constructPasswordVariable" value="${env.Module}_${env.Environment}_password"/>
<echo message= "constructPasswordVariable: ${constructPasswordVariable}" />
<propertycopy name="prop" from="${constructPasswordVariable}"/>
<echo message= "ENV VALUE: ${prop}" />
输出
constructPasswordVariable: APP1_Dev_password
ENV VALUE: asdhasd
'$ {} APPLICATIONNAME _ $ {} ENVIRON _password'可以直接使用?我错过了什么? – Rao
@Rao - $ {} APPLICATIONNAME _ $ {} ENVIRON给_password值作为APP1_Dev_Password。但是我必须使用这个值作为变量$ {APP1_Dev_Password}来获取保存在我的Build绑定中的秘密文本。我的詹金斯工作有一个秘密文本,其密码变量名称为APP1_Dev_Password。因此,要获取此值,我必须使用从$ {APPLICATIONNAME} _ $ {ENVIRON} _password收到的值。不知道如何做到这一点? – useranon