Skip to content
Snippets Groups Projects

Truncate exit codes larger than 32767

Merged Max Fan requested to merge 456982-truncate-exit-code into master
Files
2
@@ -197,7 +197,11 @@ class CommitStatus < Ci::ApplicationRecord
commit_status.failure_reason = reason.failure_reason_enum
commit_status.allow_failure = true if reason.force_allow_failure?
commit_status.exit_code = reason.exit_code if Feature.enabled?(:ci_retry_on_exit_codes, Feature.current_request)
# Windows exit codes can reach a max value of 32-bit unsigned integer
# We only allow a smallint for exit_code in the db, hence the added limit of 32767
if reason.exit_code && Feature.enabled?(:ci_retry_on_exit_codes, Feature.current_request)
commit_status.exit_code = reason.exit_code % 32768
end
end
before_transition [:skipped, :manual] => :created do |commit_status, transition|
Loading