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
Dustin 2022-12-01 20:06:59 -06:00
parent 579a42a5f0
commit 356d9ecc1d
1 changed files with 5 additions and 5 deletions

View File

@ -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'
}