We power down GitLab and the Runner Docker containers outside of business hours. When a new Runner is launched each morning, it is registered automatically with GitLab using a registration token not tied to any particular project or group. The Runner's (surprising) new default behaviour of starting locked means that the runner will be locked to nothing and so it will never pick up a job.
Steps to reproduce
Launch GitLab with a pre-set token not tied to a project or group.
Use this token to register a fresh Runner.
Runner will start locked to nothing and will never pick up jobs.
Expected behavior
Runner starts not-locked or locked to all groups or fails to start with a fatal error.
Environment description
Shared Runners v10+ running against a private GitLab instance. Both applications being run in Docker containers
Used GitLab Runner version
10.0.0+
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
@inhumantsar Could you confirm that the runner does show up under /admin/runners, as well as what the properties show for that runner? (active / tagged / locked / protected)
It does show up in /admin/runners with the shared and locked flags.
Here's an example of what I saw using the 10.1 betas. I'm currently using
10.0.0 and the behaviour is identical.
OK so... I guess I've been hit by a separate issue as well.
If I include --locked false in the command line params before--executor, the registration complains about an invalid executor. If I include it after--executor then it registers fine, but it's still showing up as locked. I've tried --locked with and without quotes around false (I've snipped some of the irrelevant options from this output)
bash-4.3# gitlab-runner register --non-interactive --name "gitlab-runner-master" --run-untagged --docker-image "docker:latest" --executor "docker+machine" ...Running in system-mode. Registering runner... succeeded runner=3vgXdhaiRunner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!bash-4.3# gitlab-runner register --non-interactive --name "gitlab-runner-master" --locked "false" --run-untagged --docker-image "docker:latest" --executor "docker+machine" ...Running in system-mode. Registering runner... succeeded runner=3vgXdhaiPANIC: Invalid executor specified Unregistering runner from GitLab succeeded runner=a3d2ae77bash-4.3# gitlab-runner register --non-interactive --name "gitlab-runner-master" --run-untagged --docker-image "docker:latest" --executor "docker+machine" ... --locked falseRunning in system-mode. Registering runner... succeeded runner=3vgXdhaiRunner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
Using the ENV var instead of the command line parameter works, the runner registers and isn't immediately locked.
So in summary, the --locked flag is a problem in conjunction --non-interactive, but the environment variable works as designed? That sounds like a flaw in the implementation.
@inhumantsar@WarheadsSE As @ayufan wrote, use the --locked=false option. It's a known weakness of used CLI library - it handles boolean flags as present-true/not present-false. If you want to directly pass the value you need to use the --flag=value pattern.
As for the main problem, we've confirmed that it's a wrong implementation in GitLab CE/EE that affects Shared Runners when locked is set to true.
In two services related to Runners and jobs we're checking if Runner can_pick? a job (for both Shared and Specific Runners):
Since Shared Runners don't have projects assigned directly this indeed ends with jobs not starting there.
After a discussion with @ayufan we've agreed that this is bad implementation. locked flag was designed to prevent Runner's from being assigned to other projects and it should affect only UI and business logic related to moving/assigning Runners. It should not affect jobs scheduling.
We'll update the assignable_for?(project) method to:
I'm deploying the runner alpine-v10.0.2 via kubernetes, and new runners with a shared token still come up as locked. I've tried with both REGISTER_LOCKED to false and without it as well, still see the same behaviour.