Welcome to mirror list, hosted at ThFree Co, Russian Federation.

group_runner.rb « resource « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d7fa26a1d53020d45f4abc8bc310f13e592dd575 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module QA
  module Resource
    class GroupRunner < RunnerBase
      attribute :group do
        Resource::Group.fabricate_via_api! do |resource|
          resource.name = "group-with-ci-cd-#{SecureRandom.hex(8)}"
          resource.description = 'Group with CI/CD Pipelines'
        end
      end

      attribute :token do
        group.runners_token
      rescue NoValueError
        group.reload!.runners_token
      end

      private

      def runner(**kwargs)
        fail_msg = "Wait for runner '#{name}' to register in group '#{group.name}'"
        Support::Retrier.retry_until(max_duration: 60, sleep_interval: 1, message: fail_msg) do
          auto_paginated_response(request_url("/runners", **kwargs)).find { |runner| runner[:description] == name }
        end
      end
    end
  end
end