Setup Jenkins to monitor external job

两盒软妹~` 提交于 2019-12-02 20:36:42

In Jenkins, you need to create a job using the "Monitor an external job" option. Give this a name, for example "nightly-backup".

On the machine where the external job is running, you need Java installed and some basic Jenkins JAR files, so that the job results can be sent to Jenkins.

As the wiki page says, on some versions of Debian or Ubuntu you can do this with:
sudo apt-get install jenkins-external-tool-monitor

Otherwise, you have to copy a bunch of JARs manually — i.e. those listed on the wiki page — to your remote machine.

Once you have the JARs available on your remote machine, you can execute whichever command you like there, so long as you prefix it with some Jenkins information: where to find the Jenkins installation, the main Java JAR, and the job name:

JENKINS_HOME=http://my-jenkins/ java -jar jenkins-core-*.jar nightly-backup ./backup.sh --nightly /home

Where http://my-jenkins/ is the base URL to Jenkins, nightly-backup matches the name of the "Monitor an external job" you created in Jenkins, and ./backup.sh --nightly /home is the command you wish to run.

The output of this ./backup.sh command will show up in Jenkins automatically once it's complete.

It looks like this is now called "jenkins-external-job-monitor", so you'd type:

sudo apt-get install jenkins-external-job-monitor
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!