我们有一个Jenkins主构建服务器构建一个项目。我们有另一个Jenkins主构建服务器,在一个大屏幕上显示“散热器”视图。
我们可以在第二个散热器视图上显示第一个母版上的构建结果吗?
发布于 2014-09-05 22:17:31
我们也有同样的需求。似乎没有Jenkins支持或插件来直接做到这一点。因此,我最终创建了一个小bash脚本,该脚本轮询其他Jenkins masters以反映构建状态。我们把它设置成每10分钟触发一次。您需要安装curl和jq才能运行以下命令:
像这样运行它:./jenkins_monitor.sh https://jenkins.example.com/job/my-job-name/
#!/bin/bash
# Remote Jenkins job monitoring script that polls the API to mirror the job status
# Useful for pulling status of jobs on other Jenkins servers into a Walldisplay
JOB_URL="$1"
if [ "$JOB_URL" == "" ]; then
echo "Usage: $0 http://{jenkins-server}/job/{job-name}"
exit
fi
JOB_DATA=`curl --fail --insecure --silent --show-error 2>&1 "${JOB_URL}/lastBuild/api/json"`
JOB_RESULT=`echo $JOB_DATA|jq .result 2>/dev/null`
if [ "$JOB_RESULT" == "" ]; then
echo "Error when retrying Jenkins job info:"
echo $JOB_DATA
exit 1
fi
echo "Job status is: ${JOB_RESULT}"
if [ "$JOB_RESULT" == '"FAILURE"' ]; then
echo "Remote job failed"
exit 1
elif [ "$JOB_RESULT" == 'null' ]; then
echo "Remote job is building"
else
echo "Job seems to be fine"
fihttps://stackoverflow.com/questions/12217991
复制相似问题