diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 21:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 21:09:00 +0300 |
commit | e4dffdfe364af6c72dcb6b4671cb39a24e8e100c (patch) | |
tree | 6428a1c3472b14396645dcb280b219dbc0420c66 /app/models | |
parent | 0ab47b994caa80c5587f33dc818626b66cfdafe2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/pipeline.rb | 6 | ||||
-rw-r--r-- | app/models/ci/pipeline_enums.rb | 11 | ||||
-rw-r--r-- | app/models/lfs_objects_project.rb | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index a8685da3cd9..bc704457be1 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -185,7 +185,7 @@ module Ci pipeline.run_after_commit do PipelineHooksWorker.perform_async(pipeline.id) - ExpirePipelineCacheWorker.perform_async(pipeline.id) + ExpirePipelineCacheWorker.perform_async(pipeline.id) if pipeline.cacheable? end end @@ -902,6 +902,10 @@ module Ci statuses.latest.success.where(name: names).pluck(:id) end + def cacheable? + Ci::PipelineEnums.ci_config_sources.key?(config_source.to_sym) + end + private def pipeline_data diff --git a/app/models/ci/pipeline_enums.rb b/app/models/ci/pipeline_enums.rb index fde169d2f03..7e203cb67c4 100644 --- a/app/models/ci/pipeline_enums.rb +++ b/app/models/ci/pipeline_enums.rb @@ -46,13 +46,18 @@ module Ci } end - def self.ci_config_sources_values - config_sources.values_at( + def self.ci_config_sources + config_sources.slice( :unknown_source, :repository_source, :auto_devops_source, :remote_source, - :external_project_source) + :external_project_source + ) + end + + def self.ci_config_sources_values + ci_config_sources.values end end end diff --git a/app/models/lfs_objects_project.rb b/app/models/lfs_objects_project.rb index e45c56b6394..68ef84223c5 100644 --- a/app/models/lfs_objects_project.rb +++ b/app/models/lfs_objects_project.rb @@ -16,6 +16,8 @@ class LfsObjectsProject < ApplicationRecord design: 2 ## EE-specific } + scope :project_id_in, ->(ids) { where(project_id: ids) } + private def update_project_statistics |