Codebase build input of a pipeline template should stay as runtime input of the consuming pipeline
U
Umber Unicorn
Summary
When a pipeline template leaves the codebase build open (
properties.ci.codebase.build: <+input>
), a pipeline that consumes the template should keep it as a runtime input automatically. Today the pipeline has to repeat build: <+input>
under templateInputs
. If it doesn't, Harness no longer treats the codebase build as a runtime input: a manual run shows no input form and fails, although the template still expects the value.Background
Our CI pipeline template leaves the codebase build open, so each run can build a branch, a tag or a pull request:
template:
type: Pipeline
spec:
properties:
ci:
codebase:
connectorRef: my_github_connector
repoName: <+pipeline.variables.REPO>
build: <+input>
Every consuming pipeline has to repeat the codebase build input:
pipeline:
template:
templateRef: org.my_pipeline_template
versionLabel: v1.0.0
templateInputs:
properties:
ci:
codebase:
build: <+input>
The block adds nothing. It only repeats what the template already says.
What we tested
- A consuming pipeline with the codebaseblock, run manually: the input form asks for the branch, tag or pull request, and the run works.
- The same pipeline without the block, run manually: Harness reports no runtime inputs. No input form is shown, and the run fails because the codebase build has no value.
- The same pipeline without the block, run by a webhook trigger: it works, because the trigger supplies the build.
Without the block, the resolved pipeline still contains
build: <+input>
from the template. The pipeline needs the codebase build, but Harness stops asking for it, and the failure only shows up on a manual run.Proposed Solution
- When the template leaves properties.ci.codebase.buildas<+input>, it stays a runtime input of the consuming pipeline, unless the pipeline sets a value for it.
- The consuming pipeline only lists properties.ci.codebaseundertemplateInputswhen it sets a value.
- The run form, input sets and triggers see the codebase build input whether or not the pipeline repeats it.
Benefits
- Consuming pipelines don't carry a codebaseblock that only repeats the template.
- Consistent behaviour across triggers: a manual run and a webhook trigger both get the codebase build input, whether or not the pipeline repeats it.