An easy way to create multiple Jenkins jobs based on a common name.

Usage no npm install needed!

<script type="module">
  import easyJenkinsJobs from 'https://cdn.skypack.dev/easy-jenkins-jobs';


Easy Jenkins Jobs


  • There are jobs on the Jenkins server that start with 'ejj_template' (this is configurable via the config.coffee file)
    • EJJ will query for all jobs with that prefix and replace it with the name specified in the POST URL

How Do I Trigger This?

  • Send a POST to http://ejj_server:1234
    • [ejj_server] is the server that EJJ is running on
  • include the following in a JSON payload
    • 'jobPrefix': the prefix you will be using to replace 'ejj_template' with
    • 'jenkinsUrl': the URL of the Jenkins server. (http://jenkins:8080/)
      • this will default to 'http://localhost:8080/' if nothing is specified

What Can I Configure?

  • port: (1337) the port that EJJ will listen on
  • jobPrefix: ('ejj_template') the prefix of jobs that will be used as templates. For every job found with this prefix, EJJ will create a copy of it with the passed in 'jobPrefix'.
  • defaultJenkinsUrl: ('http://localhost:8080/') the url that will be used if none is specified in the JSON payload
  • logLevel: ('info') the default logging level. See winston for more information.
  • defaultLogFile: ('logs/app.log') the default place to place log files. By default log files will only get as large as 1MB until a new file is started.

Getting Started

Assuming you already have Node.js and NPM installed, you can follow the below steps exactly.

git clone https://github.com/ingshtrom/easy-jenkins-jobs.git

cd easy-jenkins-jobs

npm install


node build/index.js

And voila! The server is started and you can start sending requests to the EJJ server.

What Libraries and Tools Was This Built With?

  • Atom.io - Awesome text editor build on-top of Chromium with Node.js
  • MIT License - opens source licensing
  • Node.js - Javascript on the server.
  • NPM - library management
  • Postman - client for testing HTTP APIs
  • winston - logging
  • request - send HTTP requests from Node.js
  • express - an easy way to setup RESTful web services
  • body-parser - a module for ExpressJS to parse 'req.body' into a JSON object
  • grunt - automated build system
  • grunt-contrib-clean - module for Grunt that allows for cleaning up generated directories
  • grunt-coffeelint - module for Grunt that lints CoffeeScript code and stops the build if it fails
  • grunt-contrib-coffee - module for Grunt that 'compiles' CoffeeScript into Javascript