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
a9ec4ec0
Commit
a9ec4ec0
authored
Dec 13, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make build retryable only if complete and executed
parent
5f590a71
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
app/models/ci/build.rb
app/models/ci/build.rb
+2
-1
spec/models/build_spec.rb
spec/models/build_spec.rb
+30
-8
No files found.
app/models/ci/build.rb
View file @
a9ec4ec0
...
@@ -134,7 +134,8 @@ module Ci
...
@@ -134,7 +134,8 @@ module Ci
end
end
def
retryable?
def
retryable?
project
.
builds_enabled?
&&
commands
.
present?
&&
complete?
project
.
builds_enabled?
&&
commands
.
present?
&&
(
success?
||
failed?
)
end
end
def
retried?
def
retried?
...
...
spec/models/build_spec.rb
View file @
a9ec4ec0
...
@@ -900,20 +900,42 @@ describe Ci::Build, models: true do
...
@@ -900,20 +900,42 @@ describe Ci::Build, models: true do
end
end
describe
'#retryable?'
do
describe
'#retryable?'
do
subject
{
build
}
context
'when build is retryable'
do
context
'when build is successful'
do
before
do
build
.
success!
end
it
{
is_expected
.
to
be_retryable
}
end
context
'when build is failed'
do
before
do
build
.
drop!
end
it
{
is_expected
.
to
be_retryable
}
end
end
context
'when build is not retryable'
do
context
'when build is running'
do
context
'when build is running'
do
before
do
before
do
build
.
run!
build
.
run!
end
end
it
{
expect
(
build
)
.
not_to
be_retryable
}
it
{
is_expected
.
not_to
be_retryable
}
end
end
context
'when build is finish
ed'
do
context
'when build is skipp
ed'
do
before
do
before
do
build
.
success
!
build
.
skip
!
end
end
it
{
expect
(
build
).
to
be_retryable
}
it
{
is_expected
.
not_to
be_retryable
}
end
end
end
end
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