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
76a7157c
Commit
76a7157c
authored
May 22, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstract persisted/legacy stages in pipeline model
parent
fb706d69
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
12 deletions
+18
-12
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+1
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+10
-0
app/serializers/pipeline_details_entity.rb
app/serializers/pipeline_details_entity.rb
+1
-6
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+6
-5
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
76a7157c
class
Projects::PipelinesController
<
Projects
::
ApplicationController
# before_action :whitelist_query_limiting, only: [:create, :retry]
before_action
:whitelist_query_limiting
,
only:
[
:create
,
:retry
]
# TODO?
before_action
:pipeline
,
except:
[
:index
,
:new
,
:create
,
:charts
]
before_action
:commit
,
only:
[
:show
,
:builds
,
:failures
]
before_action
:authorize_read_pipeline!
...
...
app/models/ci/pipeline.rb
View file @
76a7157c
...
...
@@ -249,6 +249,16 @@ module Ci
stage
unless
stage
.
statuses_count
.
zero?
end
##
# TODO consider switching to persisted stages only in pipelines table
# (not necessairly in the show pipeline page because of #23257.
# Hide this behind two feature flags - enabled / disabled and only
# gitlab-ce / everywhere.
#
def
stages
super
end
def
legacy_stages
# TODO, this needs refactoring, see gitlab-ce#26481.
...
...
app/serializers/pipeline_details_entity.rb
View file @
76a7157c
class
PipelineDetailsEntity
<
PipelineEntity
expose
:details
do
##
# TODO consider switching to persisted stages only in pipelines table
# (not necessairly in the show pipeline page because of #23257.
# Hide this behind two feature flags - enabled / disabled and only
# gitlab-ce / everywhere.
expose
:stages
,
as: :stages
,
using:
StageEntity
expose
:stages
,
using:
StageEntity
expose
:artifacts
,
using:
BuildArtifactEntity
expose
:manual_actions
,
using:
BuildActionEntity
end
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
76a7157c
...
...
@@ -17,8 +17,7 @@ describe Projects::PipelinesController do
describe
'GET index.json'
do
before
do
%w(pending running running success canceled)
.
each_with_index
do
|
status
,
index
|
%w(pending running success failed)
.
each_with_index
do
|
status
,
index
|
create_pipeline
(
status
,
project
.
commit
(
"HEAD~
#{
index
}
"
))
end
end
...
...
@@ -32,11 +31,13 @@ describe Projects::PipelinesController do
expect
(
response
).
to
match_response_schema
(
'pipeline'
)
expect
(
json_response
).
to
include
(
'pipelines'
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
5
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
'
5
'
expect
(
json_response
[
'count'
][
'running'
]).
to
eq
'
2
'
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
4
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
'
4
'
expect
(
json_response
[
'count'
][
'running'
]).
to
eq
'
1
'
expect
(
json_response
[
'count'
][
'pending'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'finished'
]).
to
eq
'2'
puts
queries
.
log
puts
"Queries count:
#{
queries
.
count
}
"
expect
(
queries
.
count
).
to
be
<
32
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