Commit 2b78fc45 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'mc/bug/fix-k8s-docker-runner-setup' into 'master'

Make register_instructions optional in RunnerSetup

See merge request gitlab-org/gitlab!47123
parents e2f4a758 68676776
......@@ -27,7 +27,7 @@ module Resolvers
)
{
install_instructions: instructions.install_script,
install_instructions: instructions.install_script || other_install_instructions(platform),
register_instructions: instructions.register_command
}
ensure
......@@ -36,6 +36,10 @@ module Resolvers
private
def other_install_instructions(platform)
Gitlab::Ci::RunnerInstructions::OTHER_ENVIRONMENTS[platform.to_sym][:installation_instructions_url]
end
def target_param(args)
project_param(args[:project_id]) || group_param(args[:group_id]) || {}
end
......
......@@ -8,7 +8,7 @@ module Types
field :install_instructions, GraphQL::STRING_TYPE, null: false,
description: 'Instructions for installing the runner on the specified architecture'
field :register_instructions, GraphQL::STRING_TYPE, null: false,
field :register_instructions, GraphQL::STRING_TYPE, null: true,
description: 'Instructions for registering the runner'
end
end
......
---
title: Make register_instructions optional for RunnerSetup.
merge_request: 47123
author:
type: fixed
......@@ -18411,7 +18411,7 @@ type RunnerSetup {
"""
Instructions for registering the runner
"""
registerInstructions: String!
registerInstructions: String
}
"""
......
......@@ -53211,13 +53211,9 @@
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
......@@ -2617,7 +2617,7 @@ Autogenerated return type of RunDASTScan.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `installInstructions` | String! | Instructions for installing the runner on the specified architecture |
| `registerInstructions` | String! | Instructions for registering the runner |
| `registerInstructions` | String | Instructions for registering the runner |
### SastCiConfiguration
......
......@@ -8,7 +8,24 @@ RSpec.describe Resolvers::Ci::RunnerSetupResolver do
describe '#resolve' do
let(:user) { create(:user) }
subject(:resolve_subject) { resolve(described_class, ctx: { current_user: user }, args: { platform: 'linux', architecture: 'amd64' }.merge(target_param)) }
subject(:resolve_subject) { resolve(described_class, ctx: { current_user: user }, args: { platform: platform, architecture: 'amd64' }.merge(target_param)) }
context 'with container platforms' do
let(:platform) { 'docker' }
let(:project) { create(:project) }
let(:target_param) { { project_id: project.to_global_id } }
it 'returns install instructions' do
expect(resolve_subject[:install_instructions]).not_to eq(nil)
end
it 'does not return register instructions' do
expect(resolve_subject[:register_instructions]).to eq(nil)
end
end
context 'with regular platforms' do
let(:platform) { 'linux' }
context 'without target parameter' do
let(:target_param) { {} }
......@@ -83,4 +100,5 @@ RSpec.describe Resolvers::Ci::RunnerSetupResolver do
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment