Jenkins talking to another Jenkins instance

55 views
Skip to first unread message

Seth Floyd

unread,
Jul 14, 2014, 10:25:48 AM7/14/14
to jenkins...@googlegroups.com
I currently have 2 Jenkins instances. One does our deployments and the other does automated testing. Is there a way to send a notice from Jenkins1 to Jenkins2 once a build has completed successfully to automatically kick off automated testing jobs?
(Before im berated with questions about why we are setup this way...I didn't do it, im just fixing and working with what I was brought in to deal with)

Thanks.

Phillip Campbell

unread,
Jul 14, 2014, 12:28:08 PM7/14/14
to Jenkins
This is something that we need to do as well.  We have Jenkins instances distributed globally and in one case, we need to trigger jobs remotely on other Jenkins instances.

What we do is have the remote job trigger set to "Trigger builds remotely" with a specific authentication token.  On the local machine, we execute a "curl" command to the remote job's URL, passing the authentication token and an additional parameter.

# Start the build
curl $JOB_URL/buildWithParameters?token=AUTH_TOKEN\&myParm=abcd
if [ ! "$?" = "0" ]; then
    exit 1
fi

We then use curl with json to poll the remote job for status.  If you only care about triggering the job and not the status, you can skip this part.

# Poll every sixty seconds until the build is finished
JOB_STATUS_URL=${JOB_URL}/lastBuild/api/json
while [ $GREP_RETURN_CODE -eq 0 ]
do
    sleep 60
    # Grep will return 0 while the build is running:
    curl --silent $JOB_STATUS_URL | grep result\":null > /dev/null
    GREP_RETURN_CODE=$?
done



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Seth Floyd

unread,
Jul 14, 2014, 12:30:59 PM7/14/14
to jenkins...@googlegroups.com
Awesome! Thanks. Ill try that out and see how that works.


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/bIcTx9yZhZY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

Phillip Campbell

unread,
Jul 14, 2014, 12:36:22 PM7/14/14
to Jenkins
Just to clarify, by "Status" in this case, I am checking to see when the remote job has completed, not the actual end result of the job (success/failure/unstable).

Jeff

unread,
Jul 14, 2014, 12:49:48 PM7/14/14
to jenkins...@googlegroups.com
Have you tried https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Remote+Trigger+Plugin to trigger the remote job?

I haven't used it yet so it may not work for your needs, but it is configured as a build step so I believe it blocks until the step completes which would allow you to wait before proceeding to the next step/job for testing.


Jeff Vincent
See my LinkedIn profile at:
http://www.linkedin.com/in/rjeffreyvincent

Phillip Campbell

unread,
Jul 14, 2014, 1:01:06 PM7/14/14
to Jenkins
That looks like it would do the job.  Our jobs predate this plugin so we had to use what was available at the time.

From the number of installations for this plugin, it seems that we are not alone in needing this capability... ;-)

Seth Floyd

unread,
Jul 22, 2014, 11:41:47 AM7/22/14
to jenkins...@googlegroups.com
Has anyone seen an issue where when you go to add the post-build action in your job the option for "trigger a remote parameterized job" is not in the list even though the  plugin is installed?
Reply all
Reply to author
Forward
0 new messages