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
Jérome Perrin
gitlab-ce
Commits
c00d72b6
Commit
c00d72b6
authored
Jun 01, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename pipeline methods related to legacy stages
parent
5c2ce44b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
23 deletions
+23
-23
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+1
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+9
-9
app/views/projects/builds/_sidebar.html.haml
app/views/projects/builds/_sidebar.html.haml
+1
-1
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+2
-2
app/views/projects/pipelines/_with_tabs.html.haml
app/views/projects/pipelines/_with_tabs.html.haml
+1
-1
app/views/shared/_mini_pipeline_graph.html.haml
app/views/shared/_mini_pipeline_graph.html.haml
+1
-1
lib/gitlab/data_builder/pipeline.rb
lib/gitlab/data_builder/pipeline.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+7
-7
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
c00d72b6
...
...
@@ -99,7 +99,7 @@ class Projects::PipelinesController < Projects::ApplicationController
end
def
stage
@stage
=
pipeline
.
stage
(
params
[
:stage
])
@stage
=
pipeline
.
legacy_
stage
(
params
[
:stage
])
return
not_found
unless
@stage
respond_to
do
|
format
|
...
...
app/models/ci/pipeline.rb
View file @
c00d72b6
...
...
@@ -151,21 +151,21 @@ module Ci
where
.
not
(
duration:
nil
).
sum
(
:duration
)
end
def
stage
(
name
)
stage
=
Ci
::
Stage
.
new
(
self
,
name:
name
)
stage
unless
stage
.
statuses_count
.
zero?
end
def
stages_count
statuses
.
select
(
:stage
).
distinct
.
count
end
def
stages_name
def
stages_name
s
statuses
.
order
(
:stage_idx
).
distinct
.
pluck
(
:stage
,
:stage_idx
).
map
(
&
:first
)
end
def
stages
def
legacy_stage
(
name
)
stage
=
Ci
::
Stage
.
new
(
self
,
name:
name
)
stage
unless
stage
.
statuses_count
.
zero?
end
def
legacy_stages
# TODO, this needs refactoring, see gitlab-ce#26481.
stages_query
=
statuses
...
...
@@ -300,13 +300,13 @@ module Ci
seeds_scope
=
{
ref:
ref
,
tag:
tag?
,
trigger:
trigger_requests
.
first
}
config_processor
.
stage_seeds
(
seeds_scope
).
tap
do
|
seeds
|
@seeds
||=
config_processor
.
stage_seeds
(
seeds_scope
).
tap
do
|
seeds
|
seeds
.
pipeline
=
self
end
end
def
has_stages?
stage_seeds
.
has_stages?
stage_seeds
&
.
has_stages?
end
def
has_warnings?
...
...
app/views/projects/builds/_sidebar.html.haml
View file @
c00d72b6
...
...
@@ -118,7 +118,7 @@
%span
.stage-selection
More
=
icon
(
'chevron-down'
)
%ul
.dropdown-menu
-
@build
.
pipeline
.
stages
.
each
do
|
stage
|
-
@build
.
pipeline
.
legacy_
stages
.
each
do
|
stage
|
%li
%a
.stage-item
=
stage
.
name
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
c00d72b6
...
...
@@ -72,8 +72,8 @@
Pipeline
=
link_to
"#
#{
last_pipeline
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
last_pipeline
.
id
)
=
ci_label_for_status
(
last_pipeline
.
status
)
-
if
last_pipeline
.
stages
.
any
?
with
#{
"stage"
.
pluralize
(
last_pipeline
.
stages
.
count
)
}
-
if
last_pipeline
.
stages
_count
.
nonzero
?
with
#{
"stage"
.
pluralize
(
last_pipeline
.
stages
_
count
)
}
.mr-widget-pipeline-graph
=
render
'shared/mini_pipeline_graph'
,
pipeline:
last_pipeline
,
klass:
'js-commit-pipeline-graph'
in
...
...
app/views/projects/pipelines/_with_tabs.html.haml
View file @
c00d72b6
...
...
@@ -46,7 +46,7 @@
%th
%th
Coverage
%th
=
render
partial:
"projects/stage/stage"
,
collection:
pipeline
.
stages
,
as: :stage
=
render
partial:
"projects/stage/stage"
,
collection:
pipeline
.
legacy_
stages
,
as: :stage
-
if
failed_builds
.
present?
#js-tab-failures
.build-failures.tab-pane
-
failed_builds
.
each_with_index
do
|
build
,
index
|
...
...
app/views/shared/_mini_pipeline_graph.html.haml
View file @
c00d72b6
.stage-cell
-
pipeline
.
stages
.
each
do
|
stage
|
-
pipeline
.
legacy_
stages
.
each
do
|
stage
|
-
if
stage
.
status
-
detailed_status
=
stage
.
detailed_status
(
current_user
)
-
icon_status
=
"
#{
detailed_status
.
icon
}
_borderless"
...
...
lib/gitlab/data_builder/pipeline.rb
View file @
c00d72b6
...
...
@@ -22,7 +22,7 @@ module Gitlab
sha:
pipeline
.
sha
,
before_sha:
pipeline
.
before_sha
,
status:
pipeline
.
status
,
stages:
pipeline
.
stages_name
,
stages:
pipeline
.
stages_name
s
,
created_at:
pipeline
.
created_at
,
finished_at:
pipeline
.
finished_at
,
duration:
pipeline
.
duration
...
...
spec/models/ci/pipeline_spec.rb
View file @
c00d72b6
...
...
@@ -213,8 +213,8 @@ describe Ci::Pipeline, models: true do
end
end
describe
'#stages'
do
subject
{
pipeline
.
stages
}
describe
'#
legacy_
stages'
do
subject
{
pipeline
.
legacy_
stages
}
context
'stages list'
do
it
'returns ordered list of stages'
do
...
...
@@ -263,7 +263,7 @@ describe Ci::Pipeline, models: true do
end
it
'populates stage with correct number of warnings'
do
deploy_stage
=
pipeline
.
stages
.
third
deploy_stage
=
pipeline
.
legacy_
stages
.
third
expect
(
deploy_stage
).
not_to
receive
(
:statuses
)
expect
(
deploy_stage
).
to
have_warnings
...
...
@@ -277,15 +277,15 @@ describe Ci::Pipeline, models: true do
end
end
describe
'#stages_name'
do
describe
'#stages_name
s
'
do
it
'returns a valid names of stages'
do
expect
(
pipeline
.
stages_name
).
to
eq
(
%w(build test deploy)
)
expect
(
pipeline
.
stages_name
s
).
to
eq
(
%w(build test deploy)
)
end
end
end
describe
'#stage'
do
subject
{
pipeline
.
stage
(
'test'
)
}
describe
'#
legacy_
stage'
do
subject
{
pipeline
.
legacy_
stage
(
'test'
)
}
context
'with status in stage'
do
before
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