diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-01 00:08:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-01 00:08:01 +0300 |
commit | d88cacce3f205151867ab3f9297f10cdae4a7025 (patch) | |
tree | a511ad558a92a66d0ad8ab635b99d16387be0d2d /app/models/ci | |
parent | 9e7f94a7408534411dc8da69c9e3ad3a55722b51 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/models/ci/runner.rb | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 1f147266fee..ef23987918a 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -1340,13 +1340,15 @@ module Ci persistent_ref.create end + # For dependent bridge jobs we reset the upstream bridge recursively + # to reflect that a downstream pipeline is running again def reset_source_bridge!(current_user) # break recursion when no source_pipeline bridge (first upstream pipeline) return unless bridge_waiting? return unless current_user.can?(:update_pipeline, source_bridge.pipeline) source_bridge.pending! - Ci::AfterRequeueJobService.new(project, current_user).execute(source_bridge) # rubocop:disable CodeReuse/ServiceClass + Ci::ResetSkippedJobsService.new(project, current_user).execute(source_bridge) # rubocop:disable CodeReuse/ServiceClass end # EE-only diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index d3ceec7ae36..a7f3ff938c3 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -69,7 +69,6 @@ module Ci TAG_LIST_MAX_LENGTH = 50 has_many :builds - has_many :running_builds, inverse_of: :runner, class_name: 'Ci::RunningBuild' has_many :runner_projects, inverse_of: :runner, autosave: true, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :projects, through: :runner_projects, disable_joins: true has_many :runner_namespaces, inverse_of: :runner, autosave: true @@ -91,9 +90,7 @@ module Ci scope :with_recent_runner_queue, -> { where('contacted_at > ?', recent_queue_deadline) } scope :with_running_builds, -> do - where('EXISTS(?)', - ::Ci::RunningBuild.select(1) - .where('ci_running_builds.runner_id = ci_runners.id')) + where('EXISTS(?)', ::Ci::Build.running.select(1).where('ci_builds.runner_id = ci_runners.id')) end # BACKWARD COMPATIBILITY: There are needed to maintain compatibility with `AVAILABLE_SCOPES` used by `lib/api/runners.rb` |