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
bdc10796
Commit
bdc10796
authored
Jan 07, 2021
by
Marius Bobin
Committed by
Fabio Pitino
Jan 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check runner compatibility with allow_failure:exit_codes
Check runner compatibility with allow_failure:exit_codes
parent
f8fd6d01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
2 deletions
+94
-2
app/models/ci/build.rb
app/models/ci/build.rb
+6
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+88
-1
No files found.
app/models/ci/build.rb
View file @
bdc10796
...
...
@@ -27,7 +27,8 @@ module Ci
upload_multiple_artifacts:
->
(
build
)
{
build
.
publishes_artifacts_reports?
},
refspecs:
->
(
build
)
{
build
.
merge_request_ref?
},
artifacts_exclude:
->
(
build
)
{
build
.
supports_artifacts_exclude?
},
multi_build_steps:
->
(
build
)
{
build
.
multi_build_steps?
}
multi_build_steps:
->
(
build
)
{
build
.
multi_build_steps?
},
return_exit_code:
->
(
build
)
{
build
.
exit_codes_defined?
}
}.
freeze
DEFAULT_RETRIES
=
{
...
...
@@ -1038,6 +1039,10 @@ module Ci
end
end
def
exit_codes_defined?
options
.
dig
(
:allow_failure_criteria
,
:exit_codes
).
present?
end
protected
def
run_status_commit_hooks!
...
...
spec/models/ci/build_spec.rb
View file @
bdc10796
...
...
@@ -4360,7 +4360,7 @@ RSpec.describe Ci::Build do
end
describe
'#supported_runner?'
do
let_it_be
(
:build
)
{
create
(
:ci_build
)
}
let_it_be
_with_refind
(
:build
)
{
create
(
:ci_build
)
}
subject
{
build
.
supported_runner?
(
runner_features
)
}
...
...
@@ -4425,6 +4425,41 @@ RSpec.describe Ci::Build do
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when `return_exit_code` feature is required by build'
do
let
(
:options
)
{
{
allow_failure_criteria:
{
exit_codes:
[
1
]
}
}
}
before
do
build
.
update!
(
options:
options
)
end
context
'when runner provides given feature'
do
let
(
:runner_features
)
{
{
return_exit_code:
true
}
}
it
{
is_expected
.
to
be_truthy
}
end
context
'when runner does not provide given feature'
do
let
(
:runner_features
)
{
{}
}
it
{
is_expected
.
to
be_falsey
}
end
context
'when the runner does not provide all of the required features'
do
let
(
:options
)
do
{
allow_failure_criteria:
{
exit_codes:
[
1
]
},
artifacts:
{
reports:
{
junit:
"junit.xml"
}
}
}
end
let
(
:runner_features
)
{
{
return_exit_code:
true
}
}
it
'requires `upload_multiple_artifacts` too'
do
is_expected
.
to
be_falsey
end
end
end
end
describe
'#deployment_status'
do
...
...
@@ -4927,4 +4962,56 @@ RSpec.describe Ci::Build do
end
end
end
describe
'#exit_codes_defined?'
do
let
(
:options
)
{
{}
}
before
do
build
.
options
.
merge!
(
options
)
end
subject
(
:exit_codes_defined
)
do
build
.
exit_codes_defined?
end
context
'without allow_failure_criteria'
do
it
{
is_expected
.
to
be_falsey
}
end
context
'when exit_codes is nil'
do
let
(
:options
)
do
{
allow_failure_criteria:
{
exit_codes:
nil
}
}
end
it
{
is_expected
.
to
be_falsey
}
end
context
'when exit_codes is an empty array'
do
let
(
:options
)
do
{
allow_failure_criteria:
{
exit_codes:
[]
}
}
end
it
{
is_expected
.
to
be_falsey
}
end
context
'when exit_codes are defined'
do
let
(
:options
)
do
{
allow_failure_criteria:
{
exit_codes:
[
5
,
6
]
}
}
end
it
{
is_expected
.
to
be_truthy
}
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