How to get URL of pipeline job in jenkins

9.1k views Asked by At

We are setting up a continuous delivery pipeline in Jenkins, using the build pipeline plugin.

Our deployment steps uses a proprietary deploy tool (triggered by a HTTP request from jenkins), but we need to have an additional Jenkins step for acceptance tests on the then deployed project. So our deploy tool will need to trigger the last pipeline step.

The jenkins setup for this is obvious:

For a Manually Triggered downstream build step: To add a build step that will wait for a manual trigger:

  • Select the Build Pipeline Plugin, Manually Execute Downstream Project check-box
  • Enter the name(s) of the downstream projects in the Downstream Project Names field. (n.b. Multiple projects can be specified by using comma, like "abc, def".)

Source: Build Pipeline Plugin

The problem is: I can't seem to find a way to trigger this downstream build through a URL.

In fact I'd need the URL in the deploy job, so I can send it to the deploy tool as a callback URL. Can anybody help?

2

There are 2 answers

0
learningJava On

As stated above by @rafal S do read a file which has list projects name for which build job has to be triggered do a curl HTTP POST on JENKINS_URL/job/${JOBNAME from the file}/build?token=TOKEN within a for loop , where for loop has list of all project names from the file you read

0
Rafał S On

If I understand correctly, you want to use remote access API, which to my knowledge is no different between general project or pipeline one. Take a look here:

https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

Submitting jobs Jobs without parameters You merely need to perform an HTTP POST on JENKINS_URL/job/JOBNAME/build?token=TOKEN where TOKEN is set up in the job configuration.

enter image description here