jenkins-tools/README.md
2023-12-04 15:42:38 +03:00

33 lines
885 B
Markdown

# External Jenkins pipeline helpers
## Usage:
Inside Jenkins pipeline script run two following commands:
```groovy
// 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:
```groovy
helpersPath = "/tmp/helpers.groovy"
sh "curl -L http://10.244.188.80:30210/weissmall/jenkins-tools/raw/branch/master/helpers.groovy -o $helpersPath"
helpers = load helpersPath
...
helpers.stageWithChecks('tests') {
...
}
helpers.withDockerCreds("Creds", env.DOCKER_REGISTRY_HOST) {
...
}
```