Random (collection of) scripts for Jenkins CI

License: MIT

Language: Groovy

Keywords: groovy, jenkins, sonarqube

Packagist Twitter Follow

Scripts for Jenkins CI

This repository is some sort of "desperate measure" as we use Jenkins CI quite a lot but sometimes plugins don't provide the functionality needed. Most of what we need in addition is written in Groovy to talk to other services, some of those are open sourced here. It may not always be truly elegant, but does the job while running stable in daily operations.

SonarQube Quality-Gate Check

Source: here

We're using a single, generic SonarQube Job for most projects providing some good insight into Code Quality in terms of Static Analysis.

Neither of the SonarQube Quality Gates Plugins for Jenkins provided provides a Build Step which can handle dynamic project keys (e.g. by using Jenkins Variables), so we wrote this little Groovy script to fail the build in case SonarQube reports a failed Quality-Gate.

This script is depending/tested (and running in production here) on:

How To

Your Build environemnt should be prepared using the Checkbox "Prepare SonarQube Scanner environment" beforehand.

Add a SonarQube Standalone Scanner to your Build-Jobs. SonarQube stores job data in ${WORKSPACE}/.scannerwork/report-task.txt, which is in standard properties format. So it can be injected into the Environment using the "Environment Injector" Plugin.

After injecting the Variables add a "Execute System Groovy Script" using the Script-Content from mentioned source above.

This Script will poll the SonarQube analysis status and fail the build in case the Quality Gate returns either WARNING of FAILED using the parameters provided by SonarQube during analysis.


This Vagrant box is licensed under the permissive MIT license - have fun with it!

Project Statistics

Sourcerank 5
Repository Size 7.81 KB
Stars 0
Forks 1
Watchers 5
Open issues 0
Dependencies 0
Contributors 2
Tags 1
Last updated
Last pushed

Top Contributors See all

Christian Bönning Markus Günther

Recent Tags See all

v0.0.0-dev0 December 01, 2017

Something wrong with this page? Make a suggestion

Last synced: 2017-12-01 22:54:36 UTC

Login to resync this repository