Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
49f72e70
Commit
49f72e70
authored
Aug 02, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show deployment status on a MR view
parent
cbafc9ef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
14 deletions
+46
-14
CHANGELOG
CHANGELOG
+1
-0
app/models/deployment.rb
app/models/deployment.rb
+7
-0
app/models/environment.rb
app/models/environment.rb
+6
-0
app/models/merge_request.rb
app/models/merge_request.rb
+6
-0
app/views/projects/merge_requests/widget/_heading.html.haml
app/views/projects/merge_requests/widget/_heading.html.haml
+26
-14
No files found.
CHANGELOG
View file @
49f72e70
...
...
@@ -37,6 +37,7 @@ v 8.11.0 (unreleased)
- Update `timeago` plugin to use multiple string/locale settings
- Remove unused images (ClemMakesApps)
- Limit git rev-list output count to one in forced push check
- Show deployment status on merge requests
- Clean up unused routes (Josef Strzibny)
- 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)
...
...
app/models/deployment.rb
View file @
49f72e70
...
...
@@ -36,4 +36,11 @@ class Deployment < ActiveRecord::Base
def
manual_actions
deployable
.
try
(
:other_actions
)
end
def
deployed_to
(
ref
)
commit
=
project
.
commit
(
ref
)
return
false
unless
commit
project
.
repository
.
merge_base
(
commit
.
id
,
sha
)
==
commit
.
id
end
end
app/models/environment.rb
View file @
49f72e70
...
...
@@ -25,4 +25,10 @@ class Environment < ActiveRecord::Base
def
nullify_external_url
self
.
external_url
=
nil
if
self
.
external_url
.
blank?
end
def
deployed_to?
(
ref
)
return
unless
last_deployment
last_deployment
.
deployed_to
(
ref
)
end
end
app/models/merge_request.rb
View file @
49f72e70
...
...
@@ -590,6 +590,12 @@ class MergeRequest < ActiveRecord::Base
!
pipeline
||
pipeline
.
success?
end
def
environments
target_project
.
environments
.
select
do
|
environment
|
environment
.
deployed_to?
(
ref_path
)
end
end
def
state_human_name
if
merged?
"Merged"
...
...
app/views/projects/merge_requests/widget/_heading.html.haml
View file @
49f72e70
-
if
@pipeline
.mr-widget-heading
-
%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_icon_for_status
(
status
)
%span
CI build
=
ci_label_for_status
(
status
)
for
-
commit
=
@merge_request
.
diff_head_commit
=
succeed
"."
do
=
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
=
link_to
"View details"
,
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
class:
"js-show-tab"
,
data:
{
action:
'builds'
}
-
@merge_request
.
environments
.
each
do
|
environments
|
-
%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_icon_for_status
(
status
)
%span
CI build
=
ci_label_for_status
(
status
)
for
-
commit
=
@merge_request
.
diff_head_commit
=
succeed
"."
do
=
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
=
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?
-
#
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
//
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
.mr-widget-heading
-
%w[success skipped canceled failed running pending]
.
each
do
|
status
|
.ci_widget
{
class:
"ci-#{status}"
,
style:
"display:none"
}
...
...
@@ -42,3 +43,14 @@
.ci_widget.ci-error
{
style:
"display:none"
}
=
icon
(
"times-circle"
)
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment