Skip to content

Deprecation Warning about OffPeak Settings in [runners.machine], but new [[runners|docker.machine.autoscaling]] fails to start

Summary

If I am using the old OffPeak.. Settings in the configuration so I get a deprecation warning in the logs. Setting either the '[[runners.machine.autoscaling]]' from the current documentation or '[[docker.machine.autoscaling]]' from the deprecation warning in the log file, prevents the runner/executer from starting with a 'missing Machine options'.

Steps to reproduce

1. use current gitlab runner release

[~]# gitlab-runner --version
Version:      13.0.0
Git revision: c127439c
Git branch:   13-0-stable
GO version:   go1.13.8
Built:        2020-05-20T09:06:06+0000
OS/Arch:      linux/amd64

2. reconfigure as per deprecation warning in the logs

add a valid [[runners.machine.autoscaling]]/[[docker.machine.autoscaling]] configuration to the runners config.toml,

In my case, I replaced this

  [runners.machine]
    IdleCount = 2
    IdleTime = 1800
    MaxBuilds = 100
    OffPeakPeriods = ["* * * * * sat,sun *", "* * 0-8,19-23 * * mon-fri *"]
    OffPeakIdleCount = 0
    OffPeakIdleTime = 300
    OffPeakTimezone = "UTC"

with both (runners. and docker.) versions of this

  [runners.machine]
    IdleCount = 2
    IdleTime = 1800
    MaxBuilds = 100
    [[runners.machine.autoscaling]]
      Periods = ["* * 11-20 * * mon-fri *"]
      IdleCount = 1
      IdleTime = 1200
      Timezone = "UTC"
    [[runners.machine.autoscaling]]
      Periods = ["* * * * * sat,sun *","* * 0-10,20-23 * * mon-fri *"]
      IdleCount = 0
      IdleTime = 300
      Timezone = "UTC"

but any machine configuration containing an autoscaling section will most likely fail.

Actual behavior

runner/executor fails to start with 'missing Machine options'

Expected behavior

runner/executor starts and picks up on the new autoscaling settings

Relevant logs and/or screenshots

journal will show something like this (deprecation warning):

May 26 13:34:31 ip-XXXXXX.eu-central-1.compute.internal gitlab-runner[24449]: WARNING: OffPeak docker machine configuration is deprecated and will be removed in 14.0. Please use [[docker.machine.autoscaling]] configuration instead: https://docs.gitlab.com/runner/configuration/autoscale.html#autoscaling-periods-configuration

When you actually configure either the setting mentioned in the deprecation warning or the one from the documentation, you will get the following error for the machine executor:

May 26 13:43:45 ip-XXXXX.eu-central-1.compute.internal gitlab-runner[24624]: WARNING: Failed to process runner                   builds=0 error=failed to update executor: missing Machine options executor=docker+machine runner=XXXXX

Environment description

[~]# docker-machine --version
docker-machine version 0.16.0, build 702c267f
[~]# gitlab-runner --version
Version:      13.0.0
Git revision: c127439c
Git branch:   13-0-stable
GO version:   go1.13.8
Built:        2020-05-20T09:06:06+0000
OS/Arch:      linux/amd64
[~]# uname -a
Linux XXXX.compute.internal 4.14.177-139.253.amzn2.x86_64 #1 SMP Wed Apr 29 09:56:20 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Used GitLab Runner version

[~]# gitlab-runner --version
Version:      13.0.0
Git revision: c127439c
Git branch:   13-0-stable
GO version:   go1.13.8
Built:        2020-05-20T09:06:06+0000
OS/Arch:      linux/amd64

Possible fixes

It is surely related to the configuration evaluation for docker-machine, which happens here: https://gitlab.com/gitlab-org/gitlab-runner/-/blob/da1e99a7da6ad6aee9c5c49d764cd0075b0e7333/executors/docker/machine/provider.go#L336

It might also be just a documentation/configuration error, that stated, working along the current documentation with this release is frustrating to no end, because even a 1:1 copy of a runner configuration from the documentation can end you up with the above mentioned error message and nothing further.