jenkins-tools/README.md
2023-12-04 21:09:21 +03:00

876 B

External Jenkins pipeline helpers

Usage:

Inside Jenkins pipeline script run two following commands:

// This shell command will download groovy helpers file
sh "curl -L http://[git-url]/[organization]/[repo-name]/raw/branch/master/helpers.groovy -o helpers.groovy"

// This will load script to the pipeline
load "helpers.groovy"

This can be used in scripting pipeline syntax only!

After all you will have in your pipeline all functions that helpers.groovy provides:

  • stageWithChecks
  • setSuccessCheck
  • withGiteaCreds
  • withDockerCreds

Example:

helpersPath = "/tmp/helpers.groovy"
sh "curl -L http://git.dipal.ru/Jenkins/jenkins-tools/raw/branch/master/helpers.groovy -o $helpersPath"
helpers = load helpersPath
...
helpers.stageWithChecks('tests') {
    ...
}

helpers.withDockerCreds("Creds", env.DOCKER_REGISTRY_HOST) {
    ...
}