0

I would want to launch a build of a Jenkins build job, without using plugins, but using a python script. Is there a function to do that ?

Example : I've a "job1" and a "job2". In a script of job1, I want to write something like "start(job2)"...

Any suggestion ?

cooow
  • 748
  • 11
  • 29
  • 1
    http://stackoverflow.com/questions/8512807/calling-a-jenkins-build-from-outside-of-jenkins ... good luck executing a python script without a plugin tho.. https://pythonhosted.org/python-jenkins/index.html#api-documentation – Cole9350 Mar 12 '14 at 16:34

2 Answers2

2

Not sure why you don't want to use a plugin, which would make job configuration much more simple, but you could use the Remote Access API to achieve this.

gareth_bowles
  • 20,760
  • 5
  • 52
  • 82
  • I don't want to use a plugin because I need to launch jobs according some conditions, that I can just test in python script. Thanks for your answer, I'll read this documentation! – cooow Mar 12 '14 at 16:10
1

I've found a solution : I needed to add a token to my job, and when I call my job, I use this url : "https://jenkins-server.srv/job/my-job/build?delay=0sec&token=my-token"

I've chosen the token here : (sorry for the french version)

cooow
  • 748
  • 11
  • 29