diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-10-17 16:07:06 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-10-17 16:07:06 +0900 |
commit | f75bcdc5ca871dc89bd18b218d6c79d59ec50b38 (patch) | |
tree | 984c8ee50a69e660af84bea881d0e8deac66f7c1 | |
parent | 5bb89233b8826ea2acfecd7b05db8fde62e3f588 (diff) | |
download | gitlab-ce-f75bcdc5ca871dc89bd18b218d6c79d59ec50b38.tar.gz |
Remove last_successful_deployment
-rw-r--r-- | app/models/ci/pipeline.rb | 8 | ||||
-rw-r--r-- | app/models/environment.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/ci/status/deployment/created.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/status/deployment/success.rb | 4 |
4 files changed, 12 insertions, 5 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 0649fe2846a..8856f343da5 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -615,6 +615,14 @@ module Ci .fabricate! end + def detailed_deployments_status(current_user) + deployments.map do |deployment| + Gitlab::Ci::Status::Deployment::Factory + .new(deployment, current_user) + .fabricate! + end + end + def latest_builds_with_artifacts # We purposely cast the builds to an Array here. Because we always use the # rows if there are more than 0 this prevents us from having to run two diff --git a/app/models/environment.rb b/app/models/environment.rb index c584e4e563b..00279e8db86 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -11,7 +11,6 @@ class Environment < ActiveRecord::Base has_many :deployments, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_one :last_deployment, -> { success.order('deployments.id DESC') }, class_name: 'Deployment' - has_one :last_successful_deployment, -> { success.order('deployments.id DESC') }, class_name: 'Deployment' before_validation :nullify_external_url before_validation :generate_slug, if: ->(env) { env.slug.blank? } diff --git a/lib/gitlab/ci/status/deployment/created.rb b/lib/gitlab/ci/status/deployment/created.rb index 66866a9690b..01a74b3b71d 100644 --- a/lib/gitlab/ci/status/deployment/created.rb +++ b/lib/gitlab/ci/status/deployment/created.rb @@ -12,9 +12,9 @@ module Gitlab end def deployment_path - return unless subject.environment.last_successful_deployment + return unless subject.environment.last_deployment - project_job_path(subject.project, subject.environment.last_successful_deployment.deployable) + project_job_path(subject.project, subject.environment.last_deployment.deployable) end def self.matches?(deployment, user) diff --git a/lib/gitlab/ci/status/deployment/success.rb b/lib/gitlab/ci/status/deployment/success.rb index 72f87cb6b1a..8f487872dde 100644 --- a/lib/gitlab/ci/status/deployment/success.rb +++ b/lib/gitlab/ci/status/deployment/success.rb @@ -12,9 +12,9 @@ module Gitlab end def deployment_path - return unless subject.environment.last_successful_deployment + return unless subject.environment.last_deployment - project_job_path(subject.project, subject.environment.last_successful_deployment.deployable) + project_job_path(subject.project, subject.environment.last_deployment.deployable) end def self.matches?(deployment, user) |