[英]jenkins Parameterized Trigger Plugin to trigger another build
我有2個詹金斯盒子,第一項工作用於輪詢以觸發第二項工作。 參數化的插件可以完美地工作,但是不能按照我想要的方式工作。 因此,這里的問題是我想在第一個作業獲得“ if condition”成功時觸發第二個作業(不僅僅是構建成功)。 我希望“如果條件”為真,然后僅觸發第二個作業
status=`cat ${DIR}/CRQ-*/crqDetails.properties | grep -F ENV_VALUE_10 | cut -d '=' -f2 | tail -1`
# Checking the status of the CRQ for the execution
if [[ ${status} == "Ready" ]]; then
echo "Executing ${CRQ}"
else
echo "No CRQ's for execution"
fi
如果$ status與“ Ready”匹配,則只有它應該觸發第二個作業
您可以使用簡單的cURL觸發Jenkins作業。 在服務器故障https://serverfault.com/questions/888176/how-to-trigger-jenkins-job-via-curl-command-remotely上查看此線程。
因此,觸發器將如下所示:
status=`cat ${DIR}/CRQ-*/crqDetails.properties | grep -F ENV_VALUE_10 | cut -d '=' -f2 | tail -1`
# Checking the status of the CRQ for the execution
if [[ ${status} == "Ready" ]]; then
echo "Executing ${CRQ}"
curl -u auto:<jenkins_user_token> http://<jenkins_server>/job/JOR_JOB/build?token=wefiytgwiefiweihfqweiodf
else
echo "No CRQ's for execution"
fi
遠程觸發的作業也可以參數化:)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.