Skip to content

Fix another regression on docker-machine credentials usage

What does this MR do?

Fixes another regression introduced in !578 (merged) while fixing previous regression related with similar problem.

Why was this MR needed?

If Runner uses docker+machine executor, but doesn't have [runners.docker] section in its config.toml file, then just after receiving a job, while preparing the executor, it will crash with:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4bed42]
goroutine 107 [running]:
panic(0x148d5a0, 0xc42000e020)
#011/usr/local/go/src/runtime/panic.go:500 +0x1a1
gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine.(*machineExecutor).Prepare(0xc420374a80, 0xc4202c4f00, 0xc420e1e6c0, 0x3080960, 0xc420e1e480, 0x7ffe03766f77, 0xd, 0x307f640, 0xc4202d1440, 0x307f600, ...)
#011/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine/executor.go:68 +0x1a2
gitlab.com/gitlab-org/gitlab-ci-multi-runner/common.(*Build).retryCreateExecutor(0xc420e1e6c0, 0xc4202c4f00, 0xc420e1e6c0, 0x3080960, 0xc420e1e480, 0x7ffe03766f77, 0xd, 0x307f640, 0xc4202d1440, 0x3080900, ...)
#011/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/common/build.go:314 +0x123
gitlab.com/gitlab-org/gitlab-ci-multi-runner/common.(*Build).Run(0xc420e1e6c0, 0xc4200acd80, 0x3080960, 0xc420e1e480, 0x0, 0x0)
#011/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/common/build.go:387 +0x55a
gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands.(*RunCommand).processRunner(0xc420308800, 0x41, 0xc4202c4f00, 0xc420066480, 0x0, 0x0)
#011/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands/multi.go:175 +0x851
gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands.(*RunCommand).processRunners(0xc420308800, 0x41, 0xc4201d4060, 0xc420066480)
#011/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands/multi.go:183 +0x21a
created by gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands.(*RunCommand).startWorkers
#011/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands/multi.go:199 +0x9f

Panic is raised in https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/v9.2.0/executors/docker/machine/executor.go#L68 because with no [runners.docker] section in configuration file, options.Config.Docker is nil.

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Fixes !578 (merged)

Merge request reports