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
Boxiang Sun
gitlab-ce
Commits
024523a3
Commit
024523a3
authored
Nov 05, 2018
by
Markus Doits
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one more refactor after feedback
parent
3aa85715
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
app/models/ci/build.rb
app/models/ci/build.rb
+13
-13
No files found.
app/models/ci/build.rb
View file @
024523a3
...
@@ -317,23 +317,12 @@ module Ci
...
@@ -317,23 +317,12 @@ module Ci
pipeline
.
builds
.
retried
.
where
(
name:
self
.
name
).
count
pipeline
.
builds
.
retried
.
where
(
name:
self
.
name
).
count
end
end
# The format of the retry option changed in GitLab 11.5. Before it was an
# integer only, after it is a hash. New builds always created have the
# correct format, but builds created before GitLab 11.5 and saved in
# database still have the old integer only format. This helper method makes
# sure that the format is always correct when accessing the retry options,
# even on old builds.
def
sanitized_retry_option
value
=
options
&
.
[
](
:retry
)
value
.
is_a?
(
Integer
)
?
{
max:
value
}
:
value
end
def
retries_max
def
retries_max
sanitized_retry_option
&
.
[
](
:max
)
||
0
normalized_retry
.
fetch
(
:max
,
0
)
end
end
def
retry_when
def
retry_when
sanitized_retry_option
&
.
[
](
:when
)
||
[
'always'
]
normalized_retry
.
fetch
(
:when
,
[
'always'
])
end
end
def
retry_failure?
def
retry_failure?
...
@@ -904,6 +893,17 @@ module Ci
...
@@ -904,6 +893,17 @@ module Ci
options
&
.
dig
(
:environment
,
:url
)
||
persisted_environment
&
.
external_url
options
&
.
dig
(
:environment
,
:url
)
||
persisted_environment
&
.
external_url
end
end
# The format of the retry option changed in GitLab 11.5. Before it was an
# integer only, after it is a hash. New builds always created have the
# correct format, but builds created before GitLab 11.5 and saved in
# database still have the old integer only format. This helper method makes
# sure that the format is always correct when accessing the retry options,
# even on old builds.
def
normalized_retry
value
=
options
[
:retry
]
value
.
is_a?
(
Integer
)
?
{
max:
value
}
:
value
.
to_h
end
def
build_attributes_from_config
def
build_attributes_from_config
return
{}
unless
pipeline
.
config_processor
return
{}
unless
pipeline
.
config_processor
...
...
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