summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2018-06-05 15:35:40 +0100
committerLuke Bennett <lukeeeebennettplus@gmail.com>2018-06-05 15:35:40 +0100
commitbb7f44aa8cf61d590bf45efb20c4ce19234ce03d (patch)
tree9e7142ae51453d1a9e8421e92618fd4814867465 /app/models
parentd35ad403f50b2d496f0d5938502fb55ef2190f7c (diff)
parentefed7b6dc4a9db5f3789f30ebbf9748eb716f90f (diff)
downloadgitlab-ce-bb7f44aa8cf61d590bf45efb20c4ce19234ce03d.tar.gz
Merge remote-tracking branch 'origin/master' into 39549-label-list-page-redesign-with-draggable-labels
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb13
-rw-r--r--app/models/project.rb6
2 files changed, 11 insertions, 8 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 75fd55a8f7b..d93e7cb896f 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -55,6 +55,11 @@ module Ci
where('(artifacts_file IS NOT NULL AND artifacts_file <> ?) OR EXISTS (?)',
'', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').archive)
end
+
+ scope :without_archived_trace, ->() do
+ where('NOT EXISTS (?)', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').trace)
+ end
+
scope :with_artifacts_stored_locally, -> { with_artifacts_archive.where(artifacts_file_store: [nil, LegacyArtifactUploader::Store::LOCAL]) }
scope :with_artifacts_not_expired, ->() { with_artifacts_archive.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) }
scope :with_expired_artifacts, ->() { with_artifacts_archive.where('artifacts_expire_at < ?', Time.now) }
@@ -144,6 +149,7 @@ module Ci
after_transition any => [:success] do |build|
build.run_after_commit do
BuildSuccessWorker.perform_async(id)
+ PagesWorker.perform_async(:deploy, id) if build.pages_generator?
end
end
@@ -183,6 +189,11 @@ module Ci
pipeline.manual_actions.where.not(name: name)
end
+ def pages_generator?
+ Gitlab.config.pages.enabled &&
+ self.name == 'pages'
+ end
+
def playable?
action? && (manual? || retryable?)
end
@@ -402,8 +413,6 @@ module Ci
build_data = Gitlab::DataBuilder::Build.build(self)
project.execute_hooks(build_data.dup, :job_hooks)
project.execute_services(build_data.dup, :job_hooks)
- PagesService.new(build_data).execute
- project.running_or_pending_build_count(force: true)
end
def browsable_artifacts?
diff --git a/app/models/project.rb b/app/models/project.rb
index 32298fc7f5c..a094dbcb747 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1649,12 +1649,6 @@ class Project < ActiveRecord::Base
import_state.update_column(:jid, nil)
end
- def running_or_pending_build_count(force: false)
- Rails.cache.fetch(['projects', id, 'running_or_pending_build_count'], force: force) do
- builds.running_or_pending.count(:all)
- end
- end
-
# Lazy loading of the `pipeline_status` attribute
def pipeline_status
@pipeline_status ||= Gitlab::Cache::Ci::ProjectPipelineStatus.load_for_project(self)