Update "shared runners enabled" setting on subgroup builds
What does this MR do and why?
This MR addresses #416653 (closed) by:
- moving the logic to update "shared runners enabled" setting in
update_pending_builds_async
to theCi::PendingBuilds::UpdateGroupWorker
- processing the update on subgroup builds
note: It is best reviewed commit-by-commit.
Changelog: fixed
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Step | Before | After |
---|---|---|
1. Instance runners disabled | ||
2. Instance runners re-enabled | Warning disappears and build should run. |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Go to the shell in your GDK
gitlab
directory and runbundle exec rake "gitlab:seed:runner_fleet"
. This will seed your GDK with some runners and jobs required for testing this MR. -
Create a
Playground
project in http://gdk.test:3000/rf-top-level-group-1/rf-group-1.1/rf-group-1.1.1 -
Create an instance runner in http://gdk.test:3000/admin/runners with tags
mac
,shell
,gdk
, and register it as per the instructions provided using theshell
executor. -
Make sure the runner is active (
gitlab-runner run
) -
Disable shared runners in the top-level namespace (
Enable instance runners for this group
toggle inRunners
section in http://gdk.test:3000/groups/rf-top-level-group-1/-/settings/ci_cd) -
Create the following job in the Playground project:
default: tags: - shell - gdk - mac build1: stage: build script: - echo "Do your build here"
-
Confirm by opening the job in http://gdk.test:3000/rf-top-level-group-1/rf-group-1.1/rf-group-1.1.1/playground/-/jobs that the job cannot run due to no runners being available to it
-
This can also be confirmed in the Rails console:
Ci::PendingBuild.with_instance_runners.count
should return 0. -
Enable shared runners in the top-level namespace (
Enable instance runners for this group
toggle inRunners
section in http://gdk.test:3000/groups/rf-top-level-group-1/-/settings/ci_cd). You can confirm in http://gdk.test:3000/rf-top-level-group-1/rf-group-1.1/rf-group-1.1.1/playground/-/settings/ci_cd?expand_runners=true&#js-runners-settings that the instance runner is online and available. -
Confirm that the pending job can now run. You can also check that
Ci::PendingBuild.with_instance_runners.count
now returns 1 (assuming that the Sidekiq job has run - it might be visible shortly in http://gdk.test:3000/admin/sidekiq/queues/default. If the list has pending jobs that stay there forever, perhaps you need togdk restart rails-background-jobs
). Inmaster
, this would still return 0.