Unexpected behavior with dynamic inputs when using boolean type
I want to have a boolean input with dynamic rules:
spec:
inputs:
workflow:
type: string
options: ['some-other-job', 'scan-vulnerabilities']
default: 'some-other-job'
# Used to run vulnerability scanning
run-vulnerability-scanning:
type: boolean
rules:
- if: $[[ inputs.workflow ]] == 'scan-vulnerabilities'
default: true
In this way, I would expect it to not be shown in the UI unless the expected workflow value is selected before.
However, the pipeline editor gives this warning: "This GitLab CI configuration is invalid: run-vulnerability-scanning input: default value is not a boolean.". So I can understand that a boolean input must always have a true/false value - fallback-default must exist. And by design, there's no way to dynamically hide it, like with string inputs?
But the issue continues: if I add the fallback-default value, like this:
run-vulnerability-scanning:
type: boolean
rules:
- if: $[[ inputs.workflow ]] == 'scan-vulnerabilities'
default: true
- default: false
it still shows the same warning! But it gets even more confusing: if I set it to true, the validator stops complaining. Also, if I wrap the boolean values in quotes, like 'false', it also passes the validation.
So even if the way I want to use is not supported, boolean value behavior in the fallback-default rule seems inconsistent.