Skip to content

Adds support for `options` in inputs

Laura Montemayor requested to merge support-options-with-inputs into master

What does this MR do and why?

Adds support for options in inputs.

Changelog: added

Screenshots or screen recordings

With the following spec: inputs

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

With the default value of staging :

Screenshot 2023-10-03 at 14.36.01.png

Screenshot 2023-10-03 at 14.45.48.png

With a value selected from options:

Screenshot_2023-10-03_at_14.37.34

Screenshot 2023-10-03 at 14.48.02.png

ERRORS

When trying to define a default that is not in the options array:

spec:
  inputs:
    environment:
      default: kitten
      options: [staging, test, production]

Wjemn trying to utilize a default that is not in the options:

Screenshot 2023-10-17 at 13.49.54.png

When trying to utilize a value that is not in the predefined options array:

Screenshot 2023-10-17 at 13.47.30.png

How to set up and validate locally

In a project marked as a catalog resource, add the following spec: inputs

spec:
  inputs:
    environment:
      default: staging
      options: [staging, test, production]
---    
inputs_job:
  script: echo "$[[inputs.environment]]"

There should be four use cases tested here, as shown in the screenshots above.

  1. Default value - environment:
  2. Options value - environment: anyvaluefromarray
  3. Error 1 - try to use another value that is not in the array for a default value default: kitten
  4. Error 2 - try to use a value that is not in the array environment: not-in-array

MR acceptance checklist

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

Resolves: #393401 (closed)

Edited by Laura Montemayor

Merge request reports

Loading