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
Tatuya Kamada
gitlab-ce
Commits
0e06cfc0
Commit
0e06cfc0
authored
Feb 28, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add api points for ci cd status. Add favicon.
parent
3918c303
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
68 additions
and
2 deletions
+68
-2
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+6
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+7
-1
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+6
-0
app/serializers/build_entity.rb
app/serializers/build_entity.rb
+6
-0
app/serializers/build_serializer.rb
app/serializers/build_serializer.rb
+3
-0
app/serializers/status_entity.rb
app/serializers/status_entity.rb
+1
-1
config/routes/project.rb
config/routes/project.rb
+3
-0
lib/gitlab/ci/status/build/failed_allowed.rb
lib/gitlab/ci/status/build/failed_allowed.rb
+4
-0
lib/gitlab/ci/status/canceled.rb
lib/gitlab/ci/status/canceled.rb
+4
-0
lib/gitlab/ci/status/created.rb
lib/gitlab/ci/status/created.rb
+4
-0
lib/gitlab/ci/status/failed.rb
lib/gitlab/ci/status/failed.rb
+4
-0
lib/gitlab/ci/status/pending.rb
lib/gitlab/ci/status/pending.rb
+4
-0
lib/gitlab/ci/status/running.rb
lib/gitlab/ci/status/running.rb
+4
-0
lib/gitlab/ci/status/skipped.rb
lib/gitlab/ci/status/skipped.rb
+4
-0
lib/gitlab/ci/status/success.rb
lib/gitlab/ci/status/success.rb
+4
-0
lib/gitlab/ci/status/success_warning.rb
lib/gitlab/ci/status/success_warning.rb
+4
-0
No files found.
app/controllers/projects/builds_controller.rb
View file @
0e06cfc0
...
...
@@ -91,6 +91,12 @@ class Projects::BuildsController < Projects::ApplicationController
end
end
def
ci_cd_status
render
json:
BuildSerializer
.
new
(
project:
@project
,
user:
@current_user
)
.
represent
(
@build
)
end
private
def
build
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
0e06cfc0
...
...
@@ -10,7 +10,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:module_enabled
before_action
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:conflicts
,
:conflict_for_path
,
:pipelines
,
:merge
,
:merge_check
,
:ci_status
,
:ci_environments_status
,
:toggle_subscription
,
:cancel_merge_when_pipeline_succeeds
,
:remove_wip
,
:resolve_conflicts
,
:assign_related_issues
:ci_status
,
:ci_
cd_status
,
:ci_
environments_status
,
:toggle_subscription
,
:cancel_merge_when_pipeline_succeeds
,
:remove_wip
,
:resolve_conflicts
,
:assign_related_issues
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:pipelines
]
before_action
:define_show_vars
,
only:
[
:show
,
:diffs
,
:commits
,
:conflicts
,
:conflict_for_path
,
:builds
,
:pipelines
]
...
...
@@ -473,6 +473,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render
json:
response
end
def
ci_cd_status
render
json:
PipelineSerializer
.
new
(
project:
@project
,
user:
@current_user
)
.
represent
(
@merge_request
.
head_pipeline
)
end
def
ci_environments_status
environments
=
begin
...
...
app/controllers/projects/pipelines_controller.rb
View file @
0e06cfc0
...
...
@@ -72,6 +72,12 @@ class Projects::PipelinesController < Projects::ApplicationController
end
end
def
ci_cd_status
render
json:
PipelineSerializer
.
new
(
project:
@project
,
user:
@current_user
)
.
represent
(
@pipeline
)
end
def
stage
@stage
=
pipeline
.
stage
(
params
[
:stage
])
return
not_found
unless
@stage
...
...
app/serializers/build_entity.rb
View file @
0e06cfc0
...
...
@@ -19,6 +19,12 @@ class BuildEntity < Grape::Entity
expose
:created_at
expose
:updated_at
expose
:status
do
|
build
,
options
|
StatusEntity
.
represent
(
build
.
detailed_status
(
request
.
user
),
options
)
end
private
def
path_to
(
route
,
build
)
...
...
app/serializers/build_serializer.rb
0 → 100644
View file @
0e06cfc0
class
BuildSerializer
<
BaseSerializer
entity
BuildEntity
end
app/serializers/status_entity.rb
View file @
0e06cfc0
class
StatusEntity
<
Grape
::
Entity
include
RequestAwareEntity
expose
:icon
,
:text
,
:label
,
:group
expose
:icon
,
:
favicon
,
:
text
,
:label
,
:group
expose
:has_details?
,
as: :has_details
expose
:details_path
...
...
config/routes/project.rb
View file @
0e06cfc0
...
...
@@ -102,6 +102,7 @@ constraints(ProjectUrlConstrainer.new) do
get
:merge_widget_refresh
post
:cancel_merge_when_pipeline_succeeds
get
:ci_status
get
:ci_cd_status
get
:ci_environments_status
post
:toggle_subscription
post
:remove_wip
...
...
@@ -152,6 +153,7 @@ constraints(ProjectUrlConstrainer.new) do
post
:cancel
post
:retry
get
:builds
get
:ci_cd_status
end
end
...
...
@@ -203,6 +205,7 @@ constraints(ProjectUrlConstrainer.new) do
post
:erase
get
:trace
get
:raw
get
:ci_cd_status
end
resource
:artifacts
,
only:
[]
do
...
...
lib/gitlab/ci/status/build/failed_allowed.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
'icon_status_warning'
end
def
favicon
'build_status_warning'
end
def
group
'failed_with_warnings'
end
...
...
lib/gitlab/ci/status/canceled.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_canceled'
end
def
favicon
'build_status_canceled'
end
end
end
end
...
...
lib/gitlab/ci/status/created.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_created'
end
def
favicon
'build_status_created'
end
end
end
end
...
...
lib/gitlab/ci/status/failed.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_failed'
end
def
favicon
'build_status_failed'
end
end
end
end
...
...
lib/gitlab/ci/status/pending.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_pending'
end
def
favicon
'build_status_pending'
end
end
end
end
...
...
lib/gitlab/ci/status/running.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_running'
end
def
favicon
'build_status_running'
end
end
end
end
...
...
lib/gitlab/ci/status/skipped.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_skipped'
end
def
favicon
'build_status_skipped'
end
end
end
end
...
...
lib/gitlab/ci/status/success.rb
View file @
0e06cfc0
...
...
@@ -13,6 +13,10 @@ module Gitlab
def
icon
'icon_status_success'
end
def
favicon
'build_status_success'
end
end
end
end
...
...
lib/gitlab/ci/status/success_warning.rb
View file @
0e06cfc0
...
...
@@ -20,6 +20,10 @@ module Gitlab
'icon_status_warning'
end
def
favicon
'build_status_warning'
end
def
group
'success_with_warnings'
end
...
...
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