繁体   English   中英

jenkins参数化触发器插件来触发另一个构建

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM