Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

MyBuilder Tech Blog:
Managing Jenkins Project Builds and Configuration using PHP
Jul 08, 2015 @ 14:57:22

The MyBuilder.com Tech blog has posted a tutorial showing you how to manage your Jenkins builds and configuration using PHP via the Jenkins REST API interface and a few handy curl calls.

I decided to create a simple PHP console script that can be run (or added as a git-hook) to maintain synchronization between the branch you are working on and the branch Jenkins is building. Whilst developing this script, it dawned on me that many other automated use-cases could be achieved with the ability to easily update a projects configuration file. [...] Jenkins fortunately provides us with a RESTful interface to manage typical tasks and activities. Included in this is the ability to read the XML configuration file for a specified project.

The tutorial includes examples of requests you can make to the API to do things like:

  • Reading the Projects Configuration
  • Writing to the Projects Configuration
  • Sending a Project Build Request

The post ends with the full script, a procedural process that executes each of the above steps in order (with an interesting use of the "goto" functionality).

tagged: manage jenkins build project configuration rest api tutorial curl

Link: http://tech.mybuilder.com/managing-jenkins-project-builds-and-configuration-using-php/


Trending Topics: