debian-mirror-gitlab/scripts/api/pipeline_failed_jobs.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
894 B
Ruby
Raw Normal View History

2022-11-25 23:54:43 +05:30
# frozen_string_literal: true
2023-05-27 22:25:52 +05:30
require_relative 'base'
2023-01-13 00:05:48 +05:30
2023-05-27 22:25:52 +05:30
class PipelineFailedJobs < Base
2022-11-25 23:54:43 +05:30
def initialize(options)
2023-05-27 22:25:52 +05:30
super
2022-11-25 23:54:43 +05:30
@pipeline_id = options.delete(:pipeline_id)
@exclude_allowed_to_fail_jobs = options.delete(:exclude_allowed_to_fail_jobs)
end
def execute
failed_jobs = []
client.pipeline_jobs(project, pipeline_id, scope: 'failed', per_page: 100).auto_paginate do |job|
next if exclude_allowed_to_fail_jobs && job.allow_failure
failed_jobs << job
end
client.pipeline_bridges(project, pipeline_id, scope: 'failed', per_page: 100).auto_paginate do |job|
next if exclude_allowed_to_fail_jobs && job.allow_failure
job.web_url = job.downstream_pipeline.web_url # job.web_url is linking to an invalid page
failed_jobs << job
end
failed_jobs
end
private
2023-05-27 22:25:52 +05:30
attr_reader :pipeline_id, :exclude_allowed_to_fail_jobs
2022-11-25 23:54:43 +05:30
end