Code to generate a property list for Jenkins from Gitlab.
JavaScript CSS HTML ColdFusion
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
handlers
includes
layouts
model
modules/cbcommons
views/main
Application.cfc
LICENSE
README.md
index.cfm

README.md

Jenkins Gitlab Properties Generator

Code to generate a property list of projects/branches for Jenkins from Gitlab.

Purpose

This code will generate a .properties file which can be read by the Extended Choice Parameter Script plugin in Jenkins. I use this to allow our QA person to easily deploy Git features branches to our QA server.

Requirements

Install

  • Downlod the Jenkins Gitlab Properties Generator (JGPG) code.
  • Download the latest ColdBox 4.x standalone, unzip and drop the ColdBox file in the root of the JGPG folder.

This assumes you have a working Lucee/Railo installation. If you don't, the quickest way to get this up an running is via CommandBox. Follow the installation instructions for CommandBox, download the JGPG code, open a command prompt in the JGPG directory and type 'box server start'.

This will start a server - note the port # in the prompt: 127.0.0.1:58374.

Open this URL in your browser. http://127.0.0.1:commandboxport

Configuration

  • Open /jgpg/confi/Coldbox.cfc and enter in your Gitlab URL, API key and the path to where you want your property file stored. Note the property file location needs to be readable from your Jenkins server!

    settings = {
    apiKey = 'enter-your-key-here',
    propertyPath = 'enter-path-to-where-you-want-properties-file',
    gitlaburl = 'enter-the-root-url-to-your-gitlab-instance'
    }
    

Usage

Setup a scheduled task to run this code and generate a new .properties file as needed. I run this once a day. We don't create feature branches that often and I find this is an acceptable schedule. YMMV.

See my blog about details on how to setup Jenkins using the Extended Choice Parameter Script.

Notes

This code is really overly complicated for what it does. This was just an excuse for me to try out writing something quick in ColdBox hence my use of views, etc., which in this case are really unnecessary. If I have time I would actually like to re-write this to use CommandBox.