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
iv
gitlab-ce
Commits
14f928b7
Commit
14f928b7
authored
Feb 05, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CI status badge implementation to commit controller
parent
01a406f5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+6
-0
config/routes.rb
config/routes.rb
+7
-0
No files found.
app/controllers/projects/commit_controller.rb
View file @
14f928b7
...
...
@@ -57,6 +57,12 @@ class Projects::CommitController < Projects::ApplicationController
render
layout:
false
end
def
status
status_sha
=
ci_commit
.
sha
if
ci_commit
image
=
Ci
::
ImageForBuildService
.
new
.
execute
(
@project
,
sha:
status_sha
)
send_file
(
image
.
path
,
filename:
image
.
name
,
disposition:
'inline'
,
type:
'image/svg+xml'
)
end
private
def
commit
...
...
config/routes.rb
View file @
14f928b7
...
...
@@ -493,6 +493,13 @@ Rails.application.routes.draw do
constraints:
{
id:
/(?:[^.]|\.(?!atom$))+/
,
format:
/atom/
},
as: :commits
)
get
(
'/status/*id/badge'
,
to:
'commit#status'
,
constraints:
{
format:
/png/
},
as: :commit_status
)
end
resource
:avatar
,
only:
[
:show
,
:destroy
]
...
...
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