Commit 0e886d14 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch '37402-add-error-handling-when-removing-runner' into 'master'

Fetch runners by tag when removing runner after test

Closes #37402

See merge request gitlab-org/gitlab!21094
parents 2bfa0357 fc9a7371
...@@ -115,8 +115,8 @@ module QA ...@@ -115,8 +115,8 @@ module QA
post_body post_body
end end
def runners def runners(tag_list: nil)
response = get Runtime::API::Request.new(api_client, api_runners_path).url response = get Runtime::API::Request.new(api_client, "#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}").url
parse_body(response) parse_body(response)
end end
......
...@@ -41,7 +41,17 @@ module QA ...@@ -41,7 +41,17 @@ module QA
end end
def remove_via_api! def remove_via_api!
@id = project.runners.find { |runner| runner[:description] == name }[:id] runners = project.runners(tag_list: tags)
unless runners && !runners.empty?
raise "Project #{project.path_with_namespace} has no runners with tags #{tags}."
end
this_runner = runners.find { |runner| runner[:description] == name }
unless this_runner
raise "Project #{project.path_with_namespace} does not have a runner with a description matching #{name} and tags #{tags}. Runners available: #{runners}"
end
@id = this_runner[:id]
super super
......
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