buildContainerImage: Allow passing arguments
The `registry`, `project`, `name`, and `tag` values can now be passed as keyword arguments to the `buildContainerImage` function. This will allow jobs to override the default values if necessary.testing
parent
fad319c83b
commit
b6f57b7c1a
|
@ -1,21 +1,33 @@
|
||||||
// vim: set sw=4 sts=4 ts=4 et :
|
// vim: set sw=4 sts=4 ts=4 et :
|
||||||
|
|
||||||
def call() {
|
def call(args) {
|
||||||
properties([
|
properties([
|
||||||
pipelineTriggers([cron('H H H * *')])
|
pipelineTriggers([cron('H H H * *')])
|
||||||
])
|
])
|
||||||
|
|
||||||
def registry ='git.pyrocufflink.net'
|
def registry = args.registry
|
||||||
def project = 'containerimages'
|
def project = args.project
|
||||||
def name = env.JOB_NAME.
|
def name = args.name
|
||||||
split('/')[1].
|
def tag = args.tag
|
||||||
toLowerCase().
|
if (registry == null) {
|
||||||
replaceAll('[^a-zA-z0-9._-]', '-').
|
registry = 'git.pyrocufflink.net'
|
||||||
replaceAll('^[.-]', '_')
|
}
|
||||||
def tag = env.BRANCH_NAME.
|
if (project == null) {
|
||||||
toLowerCase().
|
project = 'containerimages'
|
||||||
replaceAll('[^a-zA-z0-9._-]', '-').
|
}
|
||||||
replaceAll('^[.-]', '_')
|
if (name == null) {
|
||||||
|
name = env.JOB_NAME.
|
||||||
|
split('/')[1].
|
||||||
|
toLowerCase().
|
||||||
|
replaceAll('[^a-zA-z0-9._-]', '-').
|
||||||
|
replaceAll('^[.-]', '_')
|
||||||
|
}
|
||||||
|
if (tag == null) {
|
||||||
|
tag = env.BRANCH_NAME.
|
||||||
|
toLowerCase().
|
||||||
|
replaceAll('[^a-zA-z0-9._-]', '-').
|
||||||
|
replaceAll('^[.-]', '_')
|
||||||
|
}
|
||||||
def repo = "${registry}/${project}/${name}"
|
def repo = "${registry}/${project}/${name}"
|
||||||
def full_name = "${repo}:${tag}"
|
def full_name = "${repo}:${tag}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue