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
346a7c69
Commit
346a7c69
authored
Feb 14, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add after_stage scope to commit status class
parent
3063ab45
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-3
app/models/commit_status.rb
app/models/commit_status.rb
+3
-3
app/services/ci/retry_pipeline_service.rb
app/services/ci/retry_pipeline_service.rb
+6
-6
No files found.
app/models/ci/pipeline.rb
View file @
346a7c69
...
...
@@ -234,9 +234,7 @@ module Ci
end
def
mark_as_processable_after_stage
(
stage_idx
)
builds
.
skipped
.
where
(
'stage_idx > ?'
,
stage_idx
)
.
find_each
(
&
:process
)
builds
.
skipped
.
after_stage
(
stage_idx
).
find_each
(
&
:process
)
end
def
latest?
...
...
app/models/commit_status.rb
View file @
346a7c69
...
...
@@ -23,9 +23,6 @@ class CommitStatus < ActiveRecord::Base
where
(
id:
max_id
.
group
(
:name
,
:commit_id
))
end
scope
:retried
,
->
{
where
.
not
(
id:
latest
)
}
scope
:ordered
,
->
{
order
(
:name
)
}
scope
:failed_but_allowed
,
->
do
where
(
allow_failure:
true
,
status:
[
:failed
,
:canceled
])
end
...
...
@@ -36,8 +33,11 @@ class CommitStatus < ActiveRecord::Base
false
,
all_state_names
-
[
:failed
,
:canceled
])
end
scope
:retried
,
->
{
where
.
not
(
id:
latest
)
}
scope
:ordered
,
->
{
order
(
:name
)
}
scope
:latest_ordered
,
->
{
latest
.
ordered
.
includes
(
project: :namespace
)
}
scope
:retried_ordered
,
->
{
retried
.
ordered
.
includes
(
project: :namespace
)
}
scope
:after_stage
,
->
(
index
)
{
where
(
'stage_idx > ?'
,
index
)
}
state_machine
:status
do
event
:enqueue
do
...
...
app/services/ci/retry_pipeline_service.rb
View file @
346a7c69
...
...
@@ -11,13 +11,18 @@ module Ci
# Reprocess builds in subsequent stages
#
pipeline
.
builds
.
where
(
'stage_idx > ?'
,
resume_stage
.
index
)
.
after_stage
(
resume_stage
.
index
)
.
failed_or_canceled
.
find_each
do
|
build
|
Ci
::
RetryBuildService
.
new
(
project
,
current_user
)
.
reprocess
(
build
)
end
##
# Mark skipped builds as processable again
#
pipeline
.
mark_as_processable_after_stage
(
resume_stage
.
index
)
##
# Retry builds in the first unsuccessful stage
#
...
...
@@ -26,11 +31,6 @@ module Ci
.
new
(
project
,
current_user
)
.
retry
(
build
)
end
##
# Mark skipped builds as processable again
#
pipeline
.
mark_as_processable_after_stage
(
resume_stage
.
index
)
end
private
...
...
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