I am trying to create a WCF REST client that will communicate to Jenkins and create a job from an XML file and then build the job. My understanding is that you can do that with Jenkins.
Can some one please provide some commands that you can type on a browser's address bar to create and build jobs? ie: http:localhost/jenkins/createItem?name=TESTJOB
something along those lines.
If you want to create a job into a view given the view exists.
the build.xml filetemplate could be found in the root directory of a job's workspace
if you want to create a view:
the content of the file view.xml could be:
and to check if a view exists:
to check if a job exists:
Usually, when parsing through the documentation, it can take one or two days. It is helpful to be able to access code or curl commands to get you up and running in one hour. That is my objective with a lot of third party software.
See the post at http://scottizu.wordpress.com/2014/04/30/getting-started-with-the-jenkins-api/ which lists several of the curl commands. You will have to replace my.jenkins.com (ie JENKINS_HOST) with the your own url.
To create a job, for instance, try:
This uses a generic config. You can also download a config from a manually created job and then use that as a template.
To execute the job (and set string parameters), use:
See the Jenkins API Wiki page (including the comments at the end). You can fill in the gaps using the documentation provided by Jenkins itself; for example,
http://JENKINS_HOST/api
will give you the URL for creating a job andhttp://JENKINS_HOST/job/JOBNAME/api
will give you the URL to trigger a build.I highly recommend avoiding the custom creation of job configuration XML files and looking at something like the Job DSL plugin instead. This gives you a nice Groovy-based DSL to create jobs programmatically - much more concise and less error-prone.
Thanks to a GIST - https://gist.github.com/stuart-warren/7786892