Skip to content

Update "shared runners enabled" setting on subgroup builds

What does this MR do and why?

This MR addresses #416653 (closed) by:

  1. moving the logic to update "shared runners enabled" setting in update_pending_builds_async to the Ci::PendingBuilds::UpdateGroupWorker
  2. 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 image image
2. Instance runners re-enabled image image Warning disappears and build should run.

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Go to the shell in your GDK gitlab directory and run bundle exec rake "gitlab:seed:runner_fleet". This will seed your GDK with some runners and jobs required for testing this MR.

  2. Create a Playground project in http://gdk.test:3000/rf-top-level-group-1/rf-group-1.1/rf-group-1.1.1

  3. 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 the shell executor.

  4. Make sure the runner is active (gitlab-runner run)

  5. Disable shared runners in the top-level namespace (Enable instance runners for this group toggle in Runners section in http://gdk.test:3000/groups/rf-top-level-group-1/-/settings/ci_cd)

  6. Create the following job in the Playground project:

    default:
      tags:
        - shell
        - gdk
        - mac
    
    build1:
      stage: build
      script:
        - echo "Do your build here"
  7. 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

  8. This can also be confirmed in the Rails console: Ci::PendingBuild.with_instance_runners.count should return 0.

  9. Enable shared runners in the top-level namespace (Enable instance runners for this group toggle in Runners 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.

  10. 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 to gdk restart rails-background-jobs). In master, this would still return 0.

Edited by Pedro Pombeiro

Merge request reports