Commit 49f72e70 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Show deployment status on a MR view

parent cbafc9ef
...@@ -37,6 +37,7 @@ v 8.11.0 (unreleased) ...@@ -37,6 +37,7 @@ v 8.11.0 (unreleased)
- Update `timeago` plugin to use multiple string/locale settings - Update `timeago` plugin to use multiple string/locale settings
- Remove unused images (ClemMakesApps) - Remove unused images (ClemMakesApps)
- Limit git rev-list output count to one in forced push check - Limit git rev-list output count to one in forced push check
- Show deployment status on merge requests
- Clean up unused routes (Josef Strzibny) - Clean up unused routes (Josef Strzibny)
- Fix issue on empty project to allow developers to only push to protected branches if given permission - Fix issue on empty project to allow developers to only push to protected branches if given permission
- Add green outline to New Branch button. !5447 (winniehell) - Add green outline to New Branch button. !5447 (winniehell)
......
...@@ -36,4 +36,11 @@ class Deployment < ActiveRecord::Base ...@@ -36,4 +36,11 @@ class Deployment < ActiveRecord::Base
def manual_actions def manual_actions
deployable.try(:other_actions) deployable.try(:other_actions)
end end
def deployed_to(ref)
commit = project.commit(ref)
return false unless commit
project.repository.merge_base(commit.id, sha) == commit.id
end
end end
...@@ -25,4 +25,10 @@ class Environment < ActiveRecord::Base ...@@ -25,4 +25,10 @@ class Environment < ActiveRecord::Base
def nullify_external_url def nullify_external_url
self.external_url = nil if self.external_url.blank? self.external_url = nil if self.external_url.blank?
end end
def deployed_to?(ref)
return unless last_deployment
last_deployment.deployed_to(ref)
end
end end
...@@ -590,6 +590,12 @@ class MergeRequest < ActiveRecord::Base ...@@ -590,6 +590,12 @@ class MergeRequest < ActiveRecord::Base
!pipeline || pipeline.success? !pipeline || pipeline.success?
end end
def environments
target_project.environments.select do |environment|
environment.deployed_to?(ref_path)
end
end
def state_human_name def state_human_name
if merged? if merged?
"Merged" "Merged"
......
- if @pipeline - if @pipeline
.mr-widget-heading .mr-widget-heading
- @merge_request.environments.each do |environments|
- %w[success success_with_warnings skipped canceled failed running pending].each do |status| - %w[success success_with_warnings skipped canceled failed running pending].each do |status|
.ci_widget{ class: "ci-#{status}", style: ("display:none" unless @pipeline.status == status) } .ci_widget{ class: "ci-#{status}", style: ("display:none" unless @pipeline.status == status) }
= ci_icon_for_status(status) = ci_icon_for_status(status)
...@@ -14,8 +15,8 @@ ...@@ -14,8 +15,8 @@
= link_to "View details", builds_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: "js-show-tab", data: {action: 'builds'} = link_to "View details", builds_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: "js-show-tab", data: {action: 'builds'}
- elsif @merge_request.has_ci? - elsif @merge_request.has_ci?
- # Compatibility with old CI integrations (ex jenkins) when you request status from CI server via AJAX // Compatibility with old CI integrations (ex jenkins) when you request status from CI server via AJAX
- # Remove in later versions when services like Jenkins will set CI status via Commit status API // Remove in later versions when services like Jenkins will set CI status via Commit status API
.mr-widget-heading .mr-widget-heading
- %w[success skipped canceled failed running pending].each do |status| - %w[success skipped canceled failed running pending].each do |status|
.ci_widget{class: "ci-#{status}", style: "display:none"} .ci_widget{class: "ci-#{status}", style: "display:none"}
...@@ -42,3 +43,14 @@ ...@@ -42,3 +43,14 @@
.ci_widget.ci-error{style: "display:none"} .ci_widget.ci-error{style: "display:none"}
= icon("times-circle") = icon("times-circle")
Could not connect to the CI server. Please check your settings and try again. Could not connect to the CI server. Please check your settings and try again.
- @merge_request.environments.each do |environment|
.mr-widget-heading
.ci_widget{ class: "ci-success" }
= ci_icon_for_status("success")
%span
Released to #{environment.name}
= succeed '.' do
= time_ago_with_tooltip(environment.created_at, placement: 'bottom')
- if environment.external_url
= link_to icon('external-link'), environment.external_url
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment