Job scheduler failed to assign build when image tag is integer
Summary
When CI image tag is provided as an integer, job fails to be scheduled with no clear error. In most cases, this variable is properly coerced to a string but apparently not in all.
Steps to reproduce
Example Project
What is the current bug behavior?
- Job listed as
The scheduler failed to assign job to the runner, please try again or contact system administrator
- Error is buried in kibana due to parsing of Ci Variable instantialization
What is the expected correct behavior?
- Pipeline fails validation with clear human-readable error
- Invalid build configurations are not retried excessively
Relevant logs and/or screenshots
https://log.gprd.gitlab.net/goto/3b87eea0-8396-11ec-a649-b7cbb8e4f62e
SAST_ANALYZER_IMAGE_TAG must be of type String or nil value, while it was: Integer
"exception.backtrace": [
"lib/gitlab/ci/variables/collection/item.rb:14:in `initialize'",
"lib/gitlab/ci/variables/collection/item.rb:60:in `new'",
"lib/gitlab/ci/variables/collection/item.rb:60:in `fabricate'",
"lib/gitlab/ci/variables/collection.rb:20:in `append'",
"lib/gitlab/ci/variables/collection.rb:34:in `block (2 levels) in concat'",
"lib/gitlab/ci/variables/collection.rb:34:in `each'",
"lib/gitlab/ci/variables/collection.rb:34:in `block in concat'",
"lib/gitlab/ci/variables/collection.rb:34:in `tap'",
"lib/gitlab/ci/variables/collection.rb:34:in `concat'",
"lib/gitlab/ci/variables/builder.rb:24:in `block in scoped_variables'",
"lib/gitlab/ci/variables/builder.rb:14:in `tap'",
"lib/gitlab/ci/variables/builder.rb:14:in `scoped_variables'",
"app/models/concerns/ci/contextable.rb:14:in `block in scoped_variables'",
"app/models/concerns/ci/contextable.rb:39:in `track_duration'",
"app/models/concerns/ci/contextable.rb:13:in `scoped_variables'",
"app/models/ci/build.rb:560:in `block in variables'",
"lib/gitlab/utils/strong_memoize.rb:28:in `strong_memoize'",
"app/models/ci/build.rb:555:in `variables'",
"ee/app/models/ee/ci/build.rb:64:in `block in variables'",
"lib/gitlab/utils/strong_memoize.rb:28:in `strong_memoize'",
"ee/app/models/ee/ci/build.rb:63:in `variables'",
"app/presenters/ci/build_runner_presenter.rb:127:in `block in git_depth_variable'",
"lib/gitlab/utils/strong_memoize.rb:28:in `strong_memoize'",
"app/presenters/ci/build_runner_presenter.rb:126:in `git_depth_variable'",
"app/presenters/ci/build_runner_presenter.rb:28:in `git_depth'",
"app/presenters/ci/build_runner_presenter.rb:43:in `refspecs'",
"app/services/ci/register_job_service.rb:213:in `present_build!'",
"app/services/ci/register_job_service.rb:173:in `process_build'",
"app/services/ci/register_job_service.rb:82:in `block in process_queue'",
"app/services/ci/register_job_service.rb:140:in `block in each_build'",
"app/services/ci/register_job_service.rb:140:in `each'",
"app/services/ci/register_job_service.rb:140:in `each_build'",
"app/services/ci/register_job_service.rb:55:in `process_queue'",
"app/services/ci/register_job_service.rb:31:in `block in execute'",
"lib/gitlab/ci/queue/metrics.rb:97:in `observe_queue_time'",
"app/services/ci/register_job_service.rb:30:in `execute'",
Output of checks
This bug happens on GitLab.com
Possible fixes
Edited by Lucas Charles