GraphQL: Calculate CiRunner.upgradeStatus from aggregate of managers
What does this MR do and why?
GraphQL: Calculate CiRunner.upgradeStatus from aggregate of managers
This MR doesn't include a changelog trailer because CiRunner.upgradeStatus
is still marked as alpha.
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.
-
In rails console create a runner and some runner machines:
runner_token = Ci::Runners::CreateRunnerService.new(user: User.find(1), params: {runner_type: 'instance_type'}).execute.payload[:runner].token runner = Ci::Runner.find_by_token(runner_token) # Create some managers under runner with different versions runner.ensure_manager('test1_system_id') { |m| m.version = '15.0.0' } # upgradeStatus should be RECOMMENDED runner.ensure_manager('test2_system_id') { |m| m.version = '16.1.0' } # upgradeStatus should be NOT_AVAILABLE # Ensure that the runner version's status is calculated runner.runner_managers.each { |m| Ci::Runners::ProcessRunnerVersionUpdateService.new(m.version).execute } # Note the global ID for the following step puts runner.to_global_id.uri
-
Visit http://gdk.test:3000/-/graphql-explorer and run the following query:
{ runner(id: "gid://gitlab/Ci::Runner/9301") { id upgradeStatus managers { edges { node { id systemId version upgradeStatus } } } } }
-
The runner
upgradeStatus
should showRECOMMENDED
-
In the rails console, delete the runner machine which is listed as
RECOMMENDED
:runner.runner_managers.last.destroy!
-
Refresh the GraphQL query - the runner
upgradeStatus
should showNOT_AVAILABLE
. -
In the rails console, delete the last runner machine:
runner.runner_managers.last.destroy!
-
Refresh the GraphQL query - the runner
upgradeStatus
should shownull
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Closes #411945 (closed)