Open In App

Project Idea | Versatile Jenkins CLI

Improve
Improve
Like Article
Like
Save
Share
Report

Project Title: Versatile Jenkins CLI

Introduction:
Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing and delivering or deploying software.
The objective of this article is to create a user-friendly CLI without any external dependencies for implementing the basic features of Jenkins. It uses the Linux style of commands to operate the following features.

  • Saving the configuration file
  • Listing all the jobs for a particular credential
  • Building a particular job (both parameterized and unparameterized)
  • Build History for a Particular job
  • Displaying the output console for a particular job and a specific build number.

Diagram: 

Tools Used:

  • Jenkins Software
  • Pylint for improving the performance and documentation of Python Script
  • Jenkins HTTP API
  • Unit test cases: To check the corner cases and versatility of a particular function.
  • Curl Command: To check the correctness and validity of a particular API

API for the following features:

  1. Saving the configuration file:

    Jenkins-URL + “/job/” + JOBName + “/config.xml”

  2. Listing Jobs:

    Jenkins-URL+ “/api/json?tree=jobs[name]”

  3. Building a Job:
    • Unparameterised Job:

      Jenkins-URL + “/job/” + JOBName + “/build”

    • Parameterised Job:

      Jenkins-URL + “/job/” + JOBName + “/buildWithParameters?” + parametervalue

  4. Build History:

    Jenkins-URL + “/job/” + JOBName + “/api/json?tree=allBuilds[*]”

  5. Displaying Output Console For a Particular Job:

    Jenkins-URL + “/job/” + JOBName + “/” + BuildNumber + “/logText/progressiveText?start=0”

Application:
This project can be used anywhere i.e. both in Windows and Linux operating system as the python script does not have any kind of external dependencies. It is a user-friendly interface as just using certain appropriate commands we can access the entire details of a particular job without actually using the Jenkins Software.

  1. Github Repository Link: https://github.com/viralivora/Jenkins-CLI
  2. Research work done:
    • Learning about Jenkins API as the API’s are not well documented.
    • Going through HTTP Protocols and HTTP RFC’s
    • Curl Commands

Relevant Articles for further understanding:

Note: This project idea is contributed by Virali Vora for ProGeek Cup 2.0- A project competition by GeeksforGeeks.


Last Updated : 27 Jul, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads