fix: perform hook null check before waiting
Last 2 commits introduced fatal null-pointer exception when waiting on HookRunner object when not set, e.g. waiting for WebhookRunner when no webhook is defined. Fixed bug and got test_e2e.sh to run successfully.
This commit is contained in:
parent
5490b721d8
commit
394b2c7149
|
|
@ -638,13 +638,17 @@ func main() {
|
||||||
// Assumes that if hook channels are not nil, they will have at
|
// Assumes that if hook channels are not nil, they will have at
|
||||||
// least one value before getting closed
|
// least one value before getting closed
|
||||||
exitCode := 0 // is 0 if all hooks succeed, else is 1
|
exitCode := 0 // is 0 if all hooks succeed, else is 1
|
||||||
if err = exechookRunner.WaitForCompletion(); err != nil {
|
if exechookRunner != nil {
|
||||||
log.Error(err, "exechook completed with error")
|
if err = exechookRunner.WaitForCompletion(); err != nil {
|
||||||
exitCode = 1
|
log.Error(err, "exechook completed with error")
|
||||||
|
exitCode = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err = webhookRunner.WaitForCompletion(); err != nil {
|
if webhookRunner != nil {
|
||||||
log.Error(err, "webhook completed with error")
|
if err = webhookRunner.WaitForCompletion(); err != nil {
|
||||||
exitCode = 1
|
log.Error(err, "webhook completed with error")
|
||||||
|
exitCode = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.DeleteErrorFile()
|
log.DeleteErrorFile()
|
||||||
os.Exit(exitCode)
|
os.Exit(exitCode)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue