Backend: Interpolation inputs are ignored when header does not exist
Problem
When I pass inputs to include syntax and the including file does not specify any inputs the interpolation is skipped. I would have expected an error to be returned saying that "undefined inputs [foo] were passed to the include entry".
How to reproduce the bug?
See example here: https://gitlab.com/fabiopitino/test/-/commit/f0431dfdd5268a0d897c4e45ca845ad21280084a
Create a template that doesn't define any inputs and doesn't even have a spec: header.
# file: template.yml
job:
script: echo
Include the template passing in some inputs.
# file: .gitlab-ci.yml
include:
- local: template.yml
inputs:
foo: bar
The include works and ignores the inputs because for the template file has_header? returns false here and we skip the interpolation without errors.
Why this is a bug?
If we have an header with spec:inputs in the included file like in this commit but we use an undefined input we get an error as expected.
When inputs that are not defined are passed, the behavior should be consistent.