summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2016-11-02 17:25:19 -0500
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2016-11-08 16:50:03 -0600
commit73467bd1634898632d1c9c4e5879546ec9f53032 (patch)
tree971425b9dfd88c42d1a2a28661fba81b129ac803
parent52c06647b58a8c78c29a79a5647962c065d9ef86 (diff)
downloadgitlab-ce-73467bd1634898632d1c9c4e5879546ec9f53032.tar.gz
Add switch statement & last_deployment method
-rw-r--r--app/assets/stylesheets/pages/builds.scss6
-rw-r--r--app/models/ci/build.rb6
-rw-r--r--app/views/projects/builds/show.html.haml22
3 files changed, 31 insertions, 3 deletions
diff --git a/app/assets/stylesheets/pages/builds.scss b/app/assets/stylesheets/pages/builds.scss
index ebbec89c58c..dc694d67199 100644
--- a/app/assets/stylesheets/pages/builds.scss
+++ b/app/assets/stylesheets/pages/builds.scss
@@ -46,6 +46,12 @@
border: 1px solid $border-color;
padding: 12px $gl-padding;
border-radius: $border-radius-default;
+
+ svg {
+ position: relative;
+ top: 1px;
+ margin-right: 5px;
+ }
}
}
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index bf5f92f8462..1b37c70ee4f 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -125,6 +125,12 @@ module Ci
!self.pipeline.statuses.latest.include?(self)
end
+ def last_deployment
+ return @last_deployment if defined?(@last_deployment)
+
+ @last_deployment = Deployment.where(deployable: self).order(id: :desc).last
+ end
+
def depends_on_builds
# Get builds of the same type
latest_builds = self.pipeline.builds.latest
diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml
index 4614d0af906..6741be25ace 100644
--- a/app/views/projects/builds/show.html.haml
+++ b/app/views/projects/builds/show.html.haml
@@ -26,12 +26,28 @@
= link_to namespace_project_runners_path(@build.project.namespace, @build.project) do
Runners page
- - if @build.stage == 'deploy'
+ - if @build.deploy
.prepend-top-default
.environment-information
= ci_icon_for_status(@build.status)
- This build is the most recent deployment to
- = link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
+
+ - if @build.last_deployment
+ This build is the most recent deployment to
+ = link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
+ - else
+ - case @build.status
+ - when 'failed', 'canceled'
+ The deployment of this build to
+ = link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
+ did not complete
+ - when 'pending', 'running'
+ This build is creating a deployment to
+ = link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
+ and will overwrite the latest deployment
+ - when 'success'
+ This build is an out-of-date deployment to
+ = link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
+ View the most recent deployment #24869
.prepend-top-default
- if @build.erased?