In section Administration > System Configuration > Global Pipeline Libraries configure new library:
- Name: some desired name of library, this name can be used in pipelines to include library using
@Library
annotation; - Default version: branch or tag identifier, e.g.
master
; - Load implicitly: check if you want to load this library implicitly to all scripts, so they do not need to load it
using
@Library
annotation; - Allow default version to be overridden: allow to override Default version using
@Library
annotation; - Retrieval method
- check Modern SCM;
- check Git: DO NOT USE GitHub source, as there is currently bug;
- Project Repository:
https://github.com/BrandEmbassy/jenkins-pipeline-lib
;
Statement when
can be used instead of simple if
statement inside of stage
block, to execute statements only if
given expression evaluates true
. Anyway it will mark parent stage
as skipped.
Example:
stage('test') {
when (SKIP_TESTS == 'false') {
build(job: 'unit-tests')
}
}
Stage test
will be still visible to pipeline graph and Blue Ocean, but it will be marked as skipped, so it will not
be displayed as green with duration.