Pipeline Global Library
This repository contains a series of steps and variables for use inside of the Jenkins project’s own Jenkins instance(s).
Check this description of available services.
Useful steps:
buildPlugin
Applies the appropriate defaults for building a Maven- or Gradle-based plugin project on Linux and Windows.
You are advised to be using a 2.x parent POM.
buildPlugin()
Optional arguments
-
jdkVersions
(default:[8]
) - JDK version numbers, must match a version number jdk tool installed -
repo
(default:null
inherit from Multibranch) - custom Git repository to check out -
failFast
(default:true
) - instruct Maven tests to fail fast -
platforms
(default:['linux', 'windows']
) - Labels matching platforms to execute the steps against in parallel -
jenkinsVersions
: (default:[null]
) - a matrix of Jenkins baseline versions to build/test against in parallel (null means default, only available for Maven projects) -
findbugs
: (default:null
) - a map of parameters to run findbugs and/or archive findbugs reports. (only available for Maven projects)-
run
: set totrue
to add thefindbugs:findbugs
goal to the maven command. -
archive
: set totrue
to collect the findbugs report. -
pattern
: (default:'**/target/findbugsXml.xml'
) the file pattern for the report. -
unstableTotalAll
: (default:null
) the warnings threshold for when to mark the build as unstable, see thefindbugs
step for additional details. -
unstableNewAll
: (default:null
) the new warnings threshold for when to mark the build as unstable, see thefindbugs
step for additional details.
-
-
checkstyle
: (default:null
) - a map of parameters to run checkstyle and/or archive checkstyle reports. (only available for Maven projects)-
run
: set totrue
to add thecheckstyle:checkstyle
goal to the maven command. -
archive
: set totrue
to collect the checkstyle report. -
pattern
: (default:'**/target/checkstyle-result.xml'
) the file pattern for the report. -
unstableTotalAll
: (default:null
) the violations threshold for when to mark the build as unstable, see thecheckstyle
step for additional details. -
unstableNewAll
: (default:null
) the new violations threshold for when to mark the build as unstable, see thecheckstyle
step for additional details.
-
Note
|
findbugs and checkstyle are only run/archived on the first platform/jdkVersion,jenkinsVersion combination. So in the example below it will run for linux /jdk7 but not on jdk8 .
|
Usage:
buildPlugin(platforms: ['linux'], jdkVersions: [7, 8], findbugs: [archive: true, unstableTotalAll: '0'], checkstyle: [run: true, archive: true])
infra.isTrusted()
Determine whether the Pipeline is executing in an internal "trusted" Jenkins environment
if (infra.isTrusted()) {
/* perform some trusted action like a deployment */
}