Fix SIGSEGV in kubernetes executor Cleanup
Kubernetes executor Cleanup()
assumes POD has been created, but it will be
invoked also in case of failure during POD creation.
Closes #2553 (closed)
Starting Kubernetes command... job=43034187 project=1208199 runner=2adc161b
ERROR: Job failed (system failure): Post https://192.168.64.4:8443/api/v1/namespaces/default/secrets: x509: cert
Submitting job to coordinator... ok job=43034187 runner=2adc161b
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x1fd1e23]
goroutine 55 [running]:
gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes.(*executor).Cleanup(0xc4203de000)
/Users/nolith/src/gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes/executor_kubernetes.go:164 +0
gitlab.com/gitlab-org/gitlab-runner/common.(*Build).Run.func1(0xc42027fb80, 0xc420402dc0, 0x3f59da0, 0xc42009e28
/Users/nolith/src/gitlab.com/gitlab-org/gitlab-runner/common/build.go:372 +0x189
gitlab.com/gitlab-org/gitlab-runner/common.(*Build).Run(0xc420402dc0, 0xc42008ad00, 0x3f59da0, 0xc42009e280, 0x3
/Users/nolith/src/gitlab.com/gitlab-org/gitlab-runner/common/build.go:403 +0x5ea
gitlab.com/gitlab-org/gitlab-runner/commands.(*RunCommand).processRunner(0xc4202a9700, 0x0, 0xc4204511e0, 0xc420
/Users/nolith/src/gitlab.com/gitlab-org/gitlab-runner/commands/multi.go:175 +0x7c3
gitlab.com/gitlab-org/gitlab-runner/commands.(*RunCommand).processRunners(0xc4202a9700, 0x0, 0xc42006da40, 0xc42
/Users/nolith/src/gitlab.com/gitlab-org/gitlab-runner/commands/multi.go:183 +0x211
created by gitlab.com/gitlab-org/gitlab-runner/commands.(*RunCommand).startWorkers
/Users/nolith/src/gitlab.com/gitlab-org/gitlab-runner/commands/multi.go:199 +0x9f
Edited by Alessio Caiazza