3

Currently I can start a Jenkins job using the cli.

Example:

java -jar jenkins-cli.jar -s http://buildserver:8080 build Job_Name

I am playing around with the Jenkins multibranch pipeline feature and have not figured out how to start this type of job using the above command.

Any ideas how I can start a pipeline build via above cli?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
jstanley
  • 2,087
  • 15
  • 22
  • 1
    `java -jar jenkins-cli.jar -s http://buildserver:8080 build Job_Name` works perfectly with pipelines jobs... Could you please provide more details about what exactly is failing ? Do you get an error message ? – Pom12 Aug 23 '16 at 11:54
  • Maybe the standard "pipeline" job can start this way. I am using the "multibranch pipeline" job. When I run the job it fails with this error: # java -jar jenkins-cli.jar -s http://buildserver01:8080 build GIT_Pipeline ERROR: No such job 'GIT_Pipeline'; perhaps you meant ' TEST_int'? – jstanley Aug 23 '16 at 13:18
  • Sorry I missed the multibranch parameter ;) Please see my answer below ! – Pom12 Aug 23 '16 at 13:35
  • Thanks for the help, that solved my problem. – jstanley Aug 23 '16 at 16:18

1 Answers1

3

On a multibranch pipeline, the job name is made of both the project name and the branch because a job is actually a build on one branch, you can see the global pipeline as just a container. In the end, if your pipeline configuration is named your-project and you want to launch the job for the newfeature branch, you should do :

java -jar jenkins-cli.jar -s http://buildserver:8080 build your-project/newfeature

Also, the full project name is shown by Jenkins as shown above :

enter image description here

Pom12
  • 7,622
  • 5
  • 50
  • 69