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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d51e8e1b
Commit
d51e8e1b
authored
Feb 08, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inherit build badge access permissions from project
parent
7e1453f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
13 deletions
+7
-13
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+4
-10
doc/ci/quick_start/README.md
doc/ci/quick_start/README.md
+0
-2
features/project/builds/badge.feature
features/project/builds/badge.feature
+2
-1
features/steps/project/builds/badge.rb
features/steps/project/builds/badge.rb
+1
-0
No files found.
app/controllers/projects/builds_controller.rb
View file @
d51e8e1b
...
...
@@ -4,10 +4,6 @@ class Projects::BuildsController < Projects::ApplicationController
before_action
:authorize_update_build!
,
except:
[
:index
,
:show
,
:status
]
layout
'project'
# Skip authentication for status badge only
skip_before_action
:authenticate_user!
,
:reject_blocked!
,
:project
,
:repository
,
:authorize_manage_builds!
,
:build
,
only:
[
:badge
]
def
index
@scope
=
params
[
:scope
]
@all_builds
=
project
.
builds
...
...
@@ -51,18 +47,16 @@ class Projects::BuildsController < Projects::ApplicationController
redirect_to
build_path
(
build
)
end
def
status
render
json:
@build
.
to_json
(
only:
[
:status
,
:id
,
:sha
,
:coverage
],
methods: :sha
)
end
def
cancel
@build
.
cancel
redirect_to
build_path
(
@build
)
end
def
badge
project
=
Project
.
find_with_namespace
(
"
#{
params
[
:namespace_id
]
}
/
#{
params
[
:project_id
]
}
"
)
def
status
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
...
...
doc/ci/quick_start/README.md
View file @
d51e8e1b
...
...
@@ -192,8 +192,6 @@ You can access a builds badge image using following link:
http://example.gitlab.com/namespace/project/builds/status/branch/badge.svg
```
Build badge is available for everyone, even if your project is private or internal.
## Next steps
Awesome! You started using CI in GitLab!
...
...
features/project/builds/badge.feature
View file @
d51e8e1b
Feature
:
Project Builds Badge
Background
:
Given
project exists in some group namespace
Given
I sign in as a user
And
I own a project
And
project has CI enabled
And
project has a recent build
...
...
features/steps/project/builds/badge.rb
View file @
d51e8e1b
class
Spinach::Features::ProjectBuildsBadge
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedBuilds
include
RepoHelpers
...
...
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