GraphQL: Add systemId argument to `CiRunner.managers`
What does this MR do and why?
This MR adds a systemId
argument to CiRunner.managers
. This is a step to get GraphQL parity with the REST API endpoint parameter being added in !140667 (merged).
Changelog: added
Part of #438005
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.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
As admin, create a runner in http://gdk.test:3000/admin/runners (
New instance runner
button) -
Ensure
Run untagged jobs
is checked and clickCreate runner
-
Follow the instructions to register the runner (
gitlab-runner register
) -
Start the runner (
gitlab-runner run
) -
Run the following query in http://gdk.test:3000/-/graphql-explorer, replacing the value in
systemId
with the contents of your~/.gitlab-runner/.runner_system_id
file:{ runners(creatorId: "gid://gitlab/User/1") { nodes { id description version managers(systemId: "s_c2d22f638c25") { nodes { id systemId } } } } }
The query should return the runner you just registered, along with the runner manager. If you change the systemId
to some other value, the runners.nodes[].managers.nodes[]
collection should come out empty.
Database query plans
Ci::RunnerManager Load ↳ app/models/preloaders/runner_manager_policy_preloader.rb:16:in `execute'
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/25102/commands/79736
SELECT "ci_runner_machines".*
FROM "ci_runner_machines"
WHERE "ci_runner_machines"."runner_id" IN (/*100 runner ids*/)
AND "ci_runner_machines"."system_xid" = 's_096156a6a024'
ORDER BY "ci_runner_machines"."id" DESC
Sort (cost=196.95..196.96 rows=1 width=100) (actual time=48.854..48.873 rows=101 loops=1)
Sort Key: ci_runner_machines.id DESC
Sort Method: quicksort Memory: 39kB
Buffers: shared hit=303 read=107 dirtied=13
I/O Timings: read=4.922 write=0.000
-> Index Scan using index_ci_runner_machines_on_runner_id_and_system_xid on public.ci_runner_machines (cost=0.42..196.94 rows=1 width=100) (actual time=0.678..48.691 rows=101 loops=1)
Index Cond: ((ci_runner_machines.runner_id = ANY ('{/*100 runner ids*/}'::bigint[])) AND (ci_runner_machines.system_xid = 's_096156a6a024'::text))
Buffers: shared hit=300 read=107 dirtied=13
I/O Timings: read=4.922 write=0.000
Ci::Runner Load ↳ app/models/preloaders/runner_manager_policy_preloader.rb:16:in `execute'
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/25102/commands/79737
SELECT "ci_runners".*
FROM "ci_runners"
WHERE "ci_runners"."id" IN (/*100 runner ids*/)
Index Scan using ci_runners_pkey on public.ci_runners (cost=0.43..347.45 rows=101 width=271) (actual time=19.644..520.582 rows=101 loops=1)
Index Cond: (ci_runners.id = ANY ('{/*100 runner ids*/}'::integer[]))
Buffers: shared hit=299 read=110 dirtied=21
I/O Timings: read=481.284 write=0.000