Backend: Support needs using inputs
Summary
In attempting to use inputs
with needs
and rules`, there is no mention in our help docs for how to implement this or if it is supported.
Example
Define some input parameters using spec:inputs and then attempt to refer to those inputs using needs or rules in the CI/CD. Example:
spec:
inputs:
TEST_JOB_NAME:
description: Name of the E2E test
type: string
TEST_JOB_DEPENDENCY:
description: Other CI jobs to wait for before executing
type: string
default: ""
---
$[[ inputs.TEST_JOB_NAME ]]:
stage: test
needs:
- $[[ inputs.TEST_JOB_DEPENDENCY ]]
image: ${CI_EXECUTOR_IMAGE}
script:
- env
This results in the error: Unable to create pipeline - job:[project]:needs:need config can't be blank
Proposal
Currently, we unfortunately don't support being able to pass needs
in through inputs for the test job and if no needs
are passed in to default to not having needs
. The reason is that there's no way to have the needs:
keyword on a job without specifying a need or [].
The pipeline should be created without error, or an error message is displayed that provides information on what can be changed to allow this pipeline to execute.