Skip to content

Stop validating `default` CI input type in Entry

What does this MR do and why?

CI inputs can be 3 types - string, number, or boolean. Input default value types are validated to conform to the type of the input. Type validation for the default value is done correctly in the Interpolation::Inputs classes

However, we also validate the type of the default keyword in the Header::Input Entry class. This validation is broken because it only allows string values for default. Since there is no existing validator to type check for [String | Number | Boolean], this MR removes the default validation from Header::Input.

Also - in the future we plan to move the default value validations from Interpolation::Inputs to Header::Input. I considered doing that work now, but it would take much longer and I think it's more important that we have an expedient fix for this bug

Changelog: fixed

How to set up and validate locally

With this component;

# project: root/component-project
# file: templates/my_component.yml

spec:
  inputs:
    port:
      type: number
      default: 3000
    allow_failure:
      type: boolean
      default: true
---
test_job:
  script: ls

In the CI editor, include this component;

include:
  - component: gdk.test:3000/root/component-project/my_component@main

test:
  script: echo "Hello"

Before this MR:

Screenshot_2023-11-01_at_15.31.50

After this MR:

Valid!


Also, we still have the invalid default type error.

# project: root/component-project
# file: templates/my_component.yml

spec:
  inputs:
    port:
      type: number
      default: []
---
test_job:
  script: ls

In the CI editor, include this component;

include:
  - component: gdk.test:3000/root/component-project/my_component@main

test:
  script: echo "Hello"

Before this MR:

Screenshot_2023-11-01_at_15.31.11

After this MR:

Screenshot_2023-11-01_at_15.29.53

See that you still get an "invalid default type" error message.

MR acceptance checklist

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

Related to #429647 (closed)

Edited by Furkan Ayhan

Merge request reports