Skip to content

Conversation

maxvandermeij
Copy link
Contributor

@maxvandermeij maxvandermeij commented Oct 16, 2025

Description

Allow passthrough of the preemptive_mode value on the runner_worker_docker_autoscaler_autoscaling_options as described on the doc that is linked on the code https://docs.gitlab.com/runner/configuration/advanced-configuration/#the-runnersautoscalerpolicy-sections

Should resolve the error on the message logs

gitlab-runner: jsonschema: '/runners/0/Autoscaler/Policy/0/PreemptiveMode' does not validate with https://gitlab.com/gitlab-org/gitlab-runner/common/config#/$ref/properties/runners/items/$ref/properties/Autoscaler/$ref/properties/Policy/items/$ref/properties/PreemptiveMode/type: expected boolean, but got null

Migrations required

No migrations required

Verification

Ive confirmed this by adding the preemptive_mode value on the runner_worker_docker_autoscaler_autoscaling_options properties and confirmed by enabled the "debug_write_runner_config_to_file = true" to see it being added on the runners autoscaler policy

#module 
runner_worker_docker_autoscaler_autoscaling_options = [
  {
    periods      = ["* 7-19 * * mon-fri"]
    timezone     = "Europe/Amsterdam"
    idle_count   = 0
    idle_time    = "30m"
    scale_factor = 5
    preemptive_mode = true
  }
#toml
[[runners.autoscaler.policy]]
  idle_count = 0
  idle_time = "30m"
  periods = ["* 7-19 * * mon-fri"]
  **preemptive_mode = true**
  scale_factor = 5
  scale_factor_limit = 0
  timezone = "Europe/Amsterdam"

Copy link
Contributor

Hey @maxvandermeij! 👋

Thank you for your contribution to the project. Please refer to the contribution rules for a quick overview of the process.

Make sure that this PR clearly explains:

  • the problem being solved
  • the best way a reviewer and you can test your changes

With submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this LICENSE.

The following ChatOps commands are supported:

  • /help: notifies a maintainer to help you out

Simply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command.

This message was generated automatically. You are welcome to improve it.

@maxvandermeij
Copy link
Contributor Author

Did not yet figure out which of the values is the current default, if you find out do let me know. My guess is "false" but need to do some more testing

@kayman-mk
Copy link
Collaborator

See https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5565

It depends on idle_count.

Updated to set the current default to true based on the merge request details of the preemptive_mode addition  https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5565
@maxvandermeij
Copy link
Contributor Author

maxvandermeij commented Oct 16, 2025

See https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5565

It depends on idle_count.

So true as a default. Edit: actually not setting a default makes more sense as it will allow users to choose the behaviour type that they want. Automatic based on idle_count or specifically set based on this parameter.

@kayman-mk kayman-mk changed the title chore: add preemptive_mode option passthrough on docker_autoscaler feat: add preemptive_mode option passthrough on docker_autoscaler Oct 19, 2025
@kayman-mk kayman-mk changed the title feat: add preemptive_mode option passthrough on docker_autoscaler feat: add preemptive_mode option passthrough on docker_autoscaler Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants