Backend: Support `options:` with inputs defining `default:` value

Problem

In Implement CI Components spec, args and fabricat... (!112296 - merged) we merged support for options: to be used for validating that the input value is one of the provided options.

However, options: is not currently a supported keyword in the spec:inputs entry and the implementation in !112296 (merged) for the Ci::Input::Arguments::Options only supports required inputs (without default: value).

We also need to support optional inputs with validation through options:

spec:
  inputs:
    env:
      options: [test, staging, production]
      default: test

Proposal

  • Support options: keyword in spec:inputs entry: https://gitlab.com/gitlab-org/gitlab/-/blob/71ebc9ba40f3f1522a2d4d8e539b33a624bc3c5c/lib/gitlab/ci/config/header/input.rb#L13
  • Ensure options: is used to validate the final value from both required and optional inputs.
  • In case of an invalid input (not part of options), we should print out an error message input $[input_name] should be one of the following...

Implementation Table

Group Issue Link
backend #426596 (closed)
backend 👈 You are here
Edited Oct 16, 2023 by Mark Nuzzo
Assignee Loading
Time tracking Loading