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 :
|
||||
|
||||
def call() {
|
||||
def call(args) {
|
||||
properties([
|
||||
pipelineTriggers([cron('H H H * *')])
|
||||
])
|
||||
|
||||
def registry ='git.pyrocufflink.net'
|
||||
def project = 'containerimages'
|
||||
def name = env.JOB_NAME.
|
||||
split('/')[1].
|
||||
toLowerCase().
|
||||
replaceAll('[^a-zA-z0-9._-]', '-').
|
||||
replaceAll('^[.-]', '_')
|
||||
def tag = env.BRANCH_NAME.
|
||||
toLowerCase().
|
||||
replaceAll('[^a-zA-z0-9._-]', '-').
|
||||
replaceAll('^[.-]', '_')
|
||||
def registry = args.registry
|
||||
def project = args.project
|
||||
def name = args.name
|
||||
def tag = args.tag
|
||||
if (registry == null) {
|
||||
registry = 'git.pyrocufflink.net'
|
||||
}
|
||||
if (project == null) {
|
||||
project = 'containerimages'
|
||||
}
|
||||
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 full_name = "${repo}:${tag}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue