How to get URL of pipeline job in jenkins
Asked Answered
O

2

9

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?

Oldfangled answered 21/5, 2014 at 12:3 Comment(0)
I
2

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

Inhaler answered 17/4, 2017 at 21:26 Comment(0)
O
0

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

Overzealous answered 31/7, 2017 at 17:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.