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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
28b11963
Commit
28b11963
authored
Feb 09, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move builds badge implementation to new badges controller
parent
ee1bee58
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
14 deletions
+19
-14
app/controllers/projects/badges_controller.rb
app/controllers/projects/badges_controller.rb
+11
-0
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+0
-10
config/routes.rb
config/routes.rb
+6
-2
doc/ci/quick_start/README.md
doc/ci/quick_start/README.md
+1
-1
features/steps/project/builds/badge.rb
features/steps/project/builds/badge.rb
+1
-1
No files found.
app/controllers/projects/badges_controller.rb
0 → 100644
View file @
28b11963
class
Projects::BadgesController
<
Projects
::
ApplicationController
def
build
respond_to
do
|
format
|
format
.
html
{
render_404
}
format
.
svg
do
image
=
Ci
::
ImageForBuildService
.
new
.
execute
(
project
,
ref:
params
[
:ref
])
send_file
(
image
.
path
,
filename:
image
.
name
,
disposition:
'inline'
,
type:
'image/svg+xml'
)
end
end
end
end
app/controllers/projects/builds_controller.rb
View file @
28b11963
...
...
@@ -56,16 +56,6 @@ class Projects::BuildsController < Projects::ApplicationController
render
json:
@build
.
to_json
(
only:
[
:status
,
:id
,
:sha
,
:coverage
],
methods: :sha
)
end
def
badge
respond_to
do
|
format
|
format
.
html
{
render_404
}
format
.
svg
do
image
=
Ci
::
ImageForBuildService
.
new
.
execute
(
project
,
ref:
params
[
:ref
])
send_file
(
image
.
path
,
filename:
image
.
name
,
disposition:
'inline'
,
type:
'image/svg+xml'
)
end
end
end
private
def
build
...
...
config/routes.rb
View file @
28b11963
...
...
@@ -611,8 +611,6 @@ Rails.application.routes.draw do
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
collection
do
post
:cancel_all
get
:badge
,
path:
'status/*ref/badge'
,
constraints:
{
ref:
Gitlab
::
Regex
.
git_reference_regex
,
format:
/svg/
}
end
member
do
...
...
@@ -699,6 +697,12 @@ Rails.application.routes.draw do
end
resources
:runner_projects
,
only:
[
:create
,
:destroy
]
resources
:badges
,
only:
[],
path:
'badges/*ref'
,
constraints:
{
ref:
Gitlab
::
Regex
.
git_reference_regex
}
do
collection
do
get
:build
,
constraints:
{
format:
/svg/
}
end
end
end
end
end
...
...
doc/ci/quick_start/README.md
View file @
28b11963
...
...
@@ -189,7 +189,7 @@ GitLab, such as **Commits** and **Merge Requests**.
You can access a builds badge image using following link:
```
http://example.gitlab.com/namespace/project/b
uilds/status/branch/badge
.svg
http://example.gitlab.com/namespace/project/b
adges/branch/build
.svg
```
## Next steps
...
...
features/steps/project/builds/badge.rb
View file @
28b11963
...
...
@@ -5,7 +5,7 @@ class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
include
RepoHelpers
step
'I display builds badge for a master branch'
do
visit
b
adge_namespace_project_build
s_path
(
@project
.
namespace
,
@project
,
ref: :master
,
format: :svg
)
visit
b
uild_namespace_project_badge
s_path
(
@project
.
namespace
,
@project
,
ref: :master
,
format: :svg
)
end
step
'I should see a build success badge'
do
...
...
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