Hello,
I want to reuse the same “spec” header configuration between two gitlab-ci.yml files but only write it once for not having duplicate configuration
Currently i can only make it work with this config:
Inside a common-cicd repo:
02.test.gitlab-ci.yml
spec:
inputs:
how_to_run_test:
default: ''
options:
- ''
- pythontag
- docker
---
test:
stage: tests
image: python:3.8.1-slim-buster
before_script:
- echo $[[ inputs.how_to_run_test ]]
.common-dev.gitlab-ci.yml
spec:
inputs:
how_to_run_test:
default: ''
options:
- ''
- pythontag
- docker
---
stages:
- analysis
- tests
- build
include:
- local: extensions/01.analysis.gitlab-ci.yml
- local: extensions/02.test.gitlab-ci.yml
inputs:
how_to_run_test: $[[ inputs.how_to_run_test ]]
- local: extensions/03.build.gitlab-ci.yml
And call to .common-dev.gitlab-ci.yml
from another file inside my code repo
.gitlab-ci.yml
include:
- project: group/team/common-cicd
ref: dev
file: .common-dev.gitlab-ci.yml
inputs:
how_to_run_test: pythontag
I want to avoid having the spec also duplicated on .common-dev.gitlab-ci.yml
Is there any way with templates|includes|extends to do so?
Even if i am already “including” the 02 file, if i delete the “spec” from .common-dev.gitlab-ci.yml
i get error:
Unable to create pipeline
.common-dev.gitlab-ci.yml
: Given inputs not defined in the spec
section of the included configuration file
Thanks!