我對詹金斯的工作。 我已經建立了祕密文本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