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
On Mon, Jul 14, 2014 at 7:25 AM, Seth Floyd <[email protected]> wrote:
> 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.
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.