33 lines
876 B
Markdown
33 lines
876 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://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) {
|
|
...
|
|
}
|
|
``` |