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
6113ff99
Commit
6113ff99
authored
May 30, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose stage model attributes from pipeline object
parent
96cd4228
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+10
-0
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+2
-2
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+14
-0
No files found.
app/models/ci/pipeline.rb
View file @
6113ff99
...
@@ -292,6 +292,16 @@ module Ci
...
@@ -292,6 +292,16 @@ module Ci
sort_by
{
|
build
|
build
[
:stage_idx
]
}
sort_by
{
|
build
|
build
[
:stage_idx
]
}
end
end
def
config_stages_attributes
return
[]
unless
config_processor
config_processor
.
stages_for_ref
(
ref
,
tag?
,
trigger_requests
.
first
)
end
def
has_stages?
config_stages_attributes
.
any?
end
def
has_warnings?
def
has_warnings?
builds
.
latest
.
failed_but_allowed
.
any?
builds
.
latest
.
failed_but_allowed
.
any?
end
end
...
...
app/services/ci/create_pipeline_service.rb
View file @
6113ff99
...
@@ -42,8 +42,8 @@ module Ci
...
@@ -42,8 +42,8 @@ module Ci
return
pipeline
return
pipeline
end
end
unless
pipeline
.
config_builds_attributes
.
present
?
unless
pipeline
.
has_stages
?
return
error
(
'No
build
s for this pipeline.'
)
return
error
(
'No
stages / job
s for this pipeline.'
)
end
end
Ci
::
Pipeline
.
transaction
do
Ci
::
Pipeline
.
transaction
do
...
...
spec/models/ci/pipeline_spec.rb
View file @
6113ff99
...
@@ -502,6 +502,20 @@ describe Ci::Pipeline, models: true do
...
@@ -502,6 +502,20 @@ describe Ci::Pipeline, models: true do
end
end
end
end
describe
'#has_stages?'
do
context
'when pipeline has stages'
do
subject
{
create
(
:ci_pipeline_with_one_job
)
}
it
{
is_expected
.
to
have_stages
}
end
context
'when pipeline does not have stages'
do
subject
{
create
(
:ci_pipeline_without_jobs
)
}
it
{
is_expected
.
not_to
have_stages
}
end
end
describe
'#has_warnings?'
do
describe
'#has_warnings?'
do
subject
{
pipeline
.
has_warnings?
}
subject
{
pipeline
.
has_warnings?
}
...
...
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