Skip to content
Snippets Groups Projects

Implement exit code functionality for allow_failure

Merged Marius Bobin requested to merge ci-implement-exit-code-functionality into master
All threads resolved!
Files
6
+ 22
0
@@ -1015,6 +1015,28 @@ def debug_mode?
variables.any? { |variable| variable[:key] == 'CI_DEBUG_TRACE' && variable[:value].casecmp('true') == 0 }
end
def conditionally_allow_failure!(exit_code)
return unless ::Gitlab::Ci::Features.allow_failure_with_exit_codes_enabled?
if allowed_to_fail_with_code?(exit_code)
update_columns(allow_failure: true)
end
end
def allowed_to_fail_with_code?(exit_code)
options
.dig(:allow_failure_criteria, :exit_codes)
.to_a
.include?(exit_code)
end
def drop_with_exit_code!(failure_reason, exit_code)
transaction do
conditionally_allow_failure!(exit_code)
drop!(failure_reason)
end
end
protected
def run_status_commit_hooks!
Loading