Change machine.machineDetails to machine.Details
What does this MR do?
Renames machineDetails
struct to MachineDetails
in executors/docker/machine/details.go
(and all usages).
Why was this MR needed?
When using Runner in autoscale mode, when the machine is removed and log level is set to debug
, we're saving details to a yaml file: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/executors/docker/machine/details.go#L52.
When I compiled latest master I got a panic in such situation:
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method [recovered]
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method
goroutine 42 [running]:
panic(0x1375d40, 0xc42013e220)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.handleErr(0xc4200d7818)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/yaml.go:153 +0xe7
panic(0x1375d40, 0xc42013e220)
/usr/local/go/src/runtime/panic.go:458 +0x243
reflect.valueInterface(0x14e6560, 0xc4201b0b80, 0x1d9, 0x1375d01, 0x1375d01, 0x0)
/usr/local/go/src/reflect/value.go:918 +0x1be
reflect.Value.Interface(0x14e6560, 0xc4201b0b80, 0x1d9, 0x1375d40, 0xc42013e1e0)
/usr/local/go/src/reflect/value.go:907 +0x44
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.(*encoder).marshal(0xc42007d340, 0x0, 0x0, 0x14e6560, 0xc4201b0b80, 0x1d9)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/encode.go:67 +0x63
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.(*encoder).structv.func1()
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/encode.go:166 +0x261
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.(*encoder).mappingv(0xc42007d340, 0x0, 0x0, 0xc4200d7588)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/encode.go:196 +0x17a
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.(*encoder).structv(0xc42007d340, 0x0, 0x0, 0x1486b00, 0xc4201b0b80, 0x199)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/encode.go:184 +0xe1
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.(*encoder).marshal(0xc42007d340, 0x0, 0x0, 0x1486b00, 0xc4201b0b80, 0x199)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/encode.go:101 +0x6ca
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.(*encoder).marshal(0xc42007d340, 0x0, 0x0, 0x14620e0, 0xc4201b0b80, 0x16)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/encode.go:98 +0x671
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml%2ev2.Marshal(0x14620e0, 0xc4201b0b80, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gopkg.in/yaml.v2/yaml.go:142 +0x11c
gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers.ToYAML(0x14620e0, 0xc4201b0b80, 0x2f6ffc0, 0x18cd040)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers/converter.go:11 +0x39
gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine.(*machineDetails).writeDebugInformation(0xc4202f4360)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine/details.go:51 +0x14b
gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine.(*machineProvider).remove(0xc42000b5e0, 0xc4201b4f00, 0x32, 0xc4200d7a00, 0x1, 0x1, 0x0, 0x0)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine/provider.go:187 +0x4a5
gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine.(*machineProvider).findFreeMachine(0xc42000b5e0, 0xc420019a70, 0x3, 0x3, 0xc4202ddbb0)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine/provider.go:99 +0x1bd
gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine.(*machineProvider).Acquire(0xc42000b5e0, 0xc4201ba300, 0xc4201bdec0, 0xe, 0xc4203f94f8, 0xc42021d301)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors/docker/machine/provider.go:287 +0x91a
gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands.(*RunCommand).processRunner(0xc420098380, 0x0, 0xc4201ba300, 0xc420015ec0, 0x0, 0x0)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands/multi.go:97 +0xce
gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands.(*RunCommand).processRunners(0xc420098380, 0x0, 0xc420015f80, 0xc420015ec0)
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands/multi.go:156 +0x21a
created by gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands.(*RunCommand).startWorkers
/home/tmaczukin/Projekty/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/commands/multi.go:172 +0x9f
The problem is resolved, when the struct element machineDetails
is exported. I'm not sure if the problem is caused by updating gopkg.in/yaml.v1
to gopkg.in/yaml.v2
or by migrating to go 1.7.
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)