Skip to content

Allow setting float values for cost factor in runner edit

What does this MR do and why?

In short: allows to define float numbers as cost factors in the runner edit form.

Float is the data type that we store in the database. It's also what we use in GraphQL. In fact - some of the SaaS Linux Runners on GitLab.com have the cost factor set to a non-integer value like 0.04.

Unfortunately, without this change only integer values are allowed by the browser. Which means that in case of the example SaaS Linux Runner mentioned above, I'm unable to do any edits as the browser fails form validation and disallow to submit the form..

According to the spec here and here, the type="number" input field is by default set to step="1". Which means that only integer numbers are allowed and newer browsers are forcing such validation.

By setting this to step="any" we allow to set the cost factor to any numerical value.

Screenshots or screen recordings

before after
Screenshot_2022-10-06_at_11.17.44 image

How to set up and validate locally

  1. You should have a EE license and simulate running .com (gon.dot_com is true)
  2. Visit Admin -> Runners and select any runner
  3. The fields Public projects Minutes cost factor and Private projects Minutes cost factor should be available
  4. Verify you can input any number (especially numbers between 0 and 1, like 0.33).

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Miguel Rincon

Merge request reports