Commit 03ea0194 authored by Z.J. van de Weg's avatar Z.J. van de Weg

CI build status not per environment

parent b497b0ce
- 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) %span
%span CI build
CI build = ci_label_for_status(status)
= ci_label_for_status(status) for
for - commit = @merge_request.diff_head_commit
- commit = @merge_request.diff_head_commit = succeed "." do
= succeed "." do = link_to @pipeline.short_sha, namespace_project_commit_path(@merge_request.source_project.namespace, @merge_request.source_project, @pipeline.sha), class: "monospace"
= link_to @pipeline.short_sha, namespace_project_commit_path(@merge_request.source_project.namespace, @merge_request.source_project, @pipeline.sha), class: "monospace" %span.ci-coverage
%span.ci-coverage = 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
...@@ -48,9 +47,8 @@ ...@@ -48,9 +47,8 @@
.mr-widget-heading .mr-widget-heading
.ci_widget{ class: "ci-success" } .ci_widget{ class: "ci-success" }
= ci_icon_for_status("success") = ci_icon_for_status("success")
%span %span.hidden-sm
Released to #{environment.name} Released to #{environment.name}.
= succeed '.' do - external_url = environment.external_url
= time_ago_with_tooltip(environment.created_at, placement: 'bottom') - if external_url
- if environment.external_url = link_to icon('external-link', text: "View on #{external_url.gsub(/\A.*?:\/\//, '')}"), external_url
= link_to icon('external-link'), environment.external_url
...@@ -20,7 +20,8 @@ describe Deployment, models: true do ...@@ -20,7 +20,8 @@ describe Deployment, models: true do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
let(:deployment) do let(:deployment) do
create(:deployment, environment: environment, sha: '5f923865dde3436854e9ceb9cdb7815618d4e849') create(:deployment, environment: environment,
sha: '5f923865dde3436854e9ceb9cdb7815618d4e849')
end end
context 'when there is no project commit' do context 'when there is no project commit' do
......
...@@ -677,7 +677,10 @@ describe MergeRequest, models: true do ...@@ -677,7 +677,10 @@ describe MergeRequest, models: true do
describe "#environments" do describe "#environments" do
let(:project) { create(:project) } let(:project) { create(:project) }
let!(:deployment) { create(:deployment, environment: environment, sha: '5f923865dde3436854e9ceb9cdb7815618d4e849') } let!(:deployment) do
create(:deployment, environment: environment,
sha: '5f923865dde3436854e9ceb9cdb7815618d4e849')
end
let!(:environment) { create(:environment, project: project) } let!(:environment) { create(:environment, project: project) }
let!(:environment1) { create(:environment, project: project) } let!(:environment1) { create(:environment, project: project) }
......
...@@ -19,7 +19,7 @@ describe 'projects/merge_requests/widget/_heading' do ...@@ -19,7 +19,7 @@ describe 'projects/merge_requests/widget/_heading' do
end end
it 'displays that the environment is deployed' do it 'displays that the environment is deployed' do
expect(rendered).to match('Released to') expect(rendered).to match("Released to #{environment.name}")
end end
end end
end end
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