run_specs

in lib/gitlab/qa/component/specs.rb [113:156]


        def run_specs(name, retry_process: false, initial_run_results_host_path: nil)
          container_name = retry_process ? "#{name}-retry" : name

          env_vars = if retry_process
                       Runtime::Env.variables.merge({
                         **env,
                         "QA_RSPEC_RETRIED" => "true",
                         "NO_KNAPSACK" => "true"
                       })
                     else
                       Runtime::Env.variables.merge(env)
                     end

          env_vars["RSPEC_LAST_RUN_RESULTS_FILE"] = last_run_results_file

          run_volumes = volumes.to_h.merge({ host_artifacts_dir(container_name) => tmp_dir })
          run_volumes[initial_run_results_host_path] = last_run_results_file if retry_process

          feature_flag_sets.each do |feature_flag_set|
            @docker.run(
              image: qa_image,
              args: [suite, *args_with_flags(feature_flag_set, retry_process: retry_process)],
              mask_secrets: Runtime::Env.variables_to_mask
            ) do |command|
              command << "-t --rm --net=#{network || 'bridge'}"

              unless hostname.nil?
                command << "--hostname #{hostname}"
                command.env('QA_HOSTNAME', hostname)
              end

              if Runtime::Env.docker_add_hosts.present? || additional_hosts.present?
                hosts = Runtime::Env.docker_add_hosts.concat(additional_hosts).map { |host| "--add-host=#{host} " }.join
                command << hosts 
              end

              env_vars.each { |key, value| command.env(key, value) }
              run_volumes.each { |to, from| command.volume(to, from) }

              command.name(container_name)
            end
          end
        end