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
Léo-Paul Géneau
gitlab-ce
Commits
473b52b2
Commit
473b52b2
authored
Sep 15, 2018
by
Markus Doits
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add an option when to retry a build (unused yet)
parent
d71a7797
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
app/models/ci/build.rb
app/models/ci/build.rb
+5
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+26
-0
No files found.
app/models/ci/build.rb
View file @
473b52b2
...
@@ -324,6 +324,11 @@ module Ci
...
@@ -324,6 +324,11 @@ module Ci
retries
.
is_a?
(
Hash
)
&&
retries
.
fetch
(
:max
,
0
)
||
retries
||
0
retries
.
is_a?
(
Hash
)
&&
retries
.
fetch
(
:max
,
0
)
||
retries
||
0
end
end
def
retry_when
retries
=
self
.
options
[
:retry
]
retries
.
is_a?
(
Hash
)
&&
retries
.
fetch
(
:when
,
'always'
).
to_s
||
'always'
end
def
latest?
def
latest?
!
retried?
!
retried?
end
end
...
...
spec/models/ci/build_spec.rb
View file @
473b52b2
...
@@ -1512,6 +1512,32 @@ describe Ci::Build do
...
@@ -1512,6 +1512,32 @@ describe Ci::Build do
end
end
end
end
end
end
describe
'#retry_when'
do
context
'when value is defined'
do
subject
{
create
(
:ci_build
,
options:
{
retry:
{
when: :something
}
})
}
it
'returns the configured value'
do
expect
(
subject
.
retry_when
).
to
eq
:something
end
end
context
'when value is not defined'
do
subject
{
create
(
:ci_build
)
}
it
'returns `always`'
do
expect
(
subject
.
retry_when
).
to
eq
:always
end
end
context
'when retry is only defined as an integer'
do
subject
{
create
(
:ci_build
,
options:
{
retry:
1
})
}
it
'returns `always`'
do
expect
(
subject
.
retry_when
).
to
eq
:always
end
end
end
end
end
describe
'#keep_artifacts!'
do
describe
'#keep_artifacts!'
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