buildContainerImage: Handle null arguments
If the `buildContainerImage` method is called without passing any arguments at all, the `args` object will be `null`. Attempting to access the properties of it in that case raises a `NullPointerException`. Fortunately, Groovy has a `?` operator that returns `null` when the named object is `null` and avoids accessing its properties.testing
parent
579a42a5f0
commit
356d9ecc1d
|
@ -5,11 +5,11 @@ def call(args) {
|
|||
pipelineTriggers([cron('H H H * *')])
|
||||
])
|
||||
|
||||
def registry = args.registry
|
||||
def project = args.project
|
||||
def name = args.name
|
||||
def tag = args.tag
|
||||
def arch = args.arch
|
||||
def registry = args?.registry
|
||||
def project = args?.project
|
||||
def name = args?.name
|
||||
def tag = args?.tag
|
||||
def arch = args?.arch
|
||||
if (registry == null) {
|
||||
registry = 'git.pyrocufflink.net'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue