diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 21:18:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 21:18:33 +0300 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/models/ci/pipeline.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r-- | app/models/ci/pipeline.rb | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 3be107ea2e1..b63ec0c8a97 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -228,7 +228,7 @@ module Ci pipeline.run_after_commit do PipelineHooksWorker.perform_async(pipeline.id) - ExpirePipelineCacheWorker.perform_async(pipeline.id) if pipeline.cacheable? + ExpirePipelineCacheWorker.perform_async(pipeline.id) end end @@ -573,7 +573,7 @@ module Ci end def cancel_running(retries: nil) - retry_optimistic_lock(cancelable_statuses, retries) do |cancelable| + retry_optimistic_lock(cancelable_statuses, retries, name: 'ci_pipeline_cancel_running') do |cancelable| cancelable.find_each do |job| yield(job) if block_given? job.cancel @@ -693,14 +693,6 @@ module Ci .exists? end - # TODO: this logic is duplicate with Pipeline::Chain::Config::Content - # we should persist this is `ci_pipelines.config_path` - def config_path - return unless repository_source? || unknown_source? - - project.ci_config_path_or_default - end - def has_yaml_errors? yaml_errors.present? end @@ -744,7 +736,7 @@ module Ci end def set_status(new_status) - retry_optimistic_lock(self) do + retry_optimistic_lock(self, name: 'ci_pipeline_set_status') do case new_status when 'created' then nil when 'waiting_for_resource' then request_resource @@ -785,8 +777,7 @@ module Ci Gitlab::Ci::Variables::Collection.new.tap do |variables| variables.append(key: 'CI_PIPELINE_IID', value: iid.to_s) variables.append(key: 'CI_PIPELINE_SOURCE', value: source.to_s) - - variables.append(key: 'CI_CONFIG_PATH', value: config_path) + variables.append(key: 'CI_PIPELINE_CREATED_AT', value: created_at&.iso8601) variables.concat(predefined_commit_variables) @@ -938,6 +929,12 @@ module Ci .first end + def self_with_ancestors_and_descendants(same_project: false) + ::Gitlab::Ci::PipelineObjectHierarchy + .new(self.class.unscoped.where(id: id), options: { same_project: same_project }) + .all_objects + end + def bridge_triggered? source_bridge.present? end @@ -1117,7 +1114,7 @@ module Ci detached_merge_request_pipeline? && !merge_request_ref? end - def merge_request_pipeline? + def merged_result_pipeline? merge_request? && target_sha.present? end @@ -1157,7 +1154,7 @@ module Ci return unless merge_request? strong_memoize(:merge_request_event_type) do - if merge_request_pipeline? + if merged_result_pipeline? :merged_result elsif detached_merge_request_pipeline? :detached @@ -1169,10 +1166,6 @@ module Ci @persistent_ref ||= PersistentRef.new(pipeline: self) end - def cacheable? - !dangling? - end - def dangling? Enums::Ci::Pipeline.dangling_sources.key?(source.to_sym) end @@ -1247,7 +1240,7 @@ module Ci def merge_request_diff_sha return unless merge_request? - if merge_request_pipeline? + if merged_result_pipeline? source_sha else sha |