Hi everyone …
I am testing the new CI/CD catalog
feature and have currently the problem that I cannot reuse a template several times - each time with other dynamic values. I have started to play arround with the catalog only two weeks ago, so there is a great chance that I am just doing something wrong or that I have missunderstood the concept. So here we go …
My template looks like this:
//test-template.yml
spec:
inputs:
test-text:
default: default-text
stage:
default: stage1
---
.test-template:
stage: $[[ inputs.stage ]]
image: alpine:latest
script:
- echo $[[ inputs.test-text]]
Within the .gitlab-ci.yml
I have defined two local files where I use this template.
//.gitlab-ci.yml
stages:
- stage1
- stage2
include:
- local: '/.gitlab/.test-components1.yml'
- local: '/.gitlab/.test-components2.yml'
The /.gitlab/.test-components1.yml
file looks like this:
include:
- component: [PATH_TO_COMPONENT]/test-template@~latest
inputs:
stage: stage1
test-text: test1
test-component1:
extends: .test-template
rules:
- if: $CI_COMMIT_TAG
The other one /.gitlab/.test-components2.yml
looks like this:
include:
- component: [PATH_TO_COMPONENT]/test-template@~latest
inputs:
stage: stage2
test-text: test2
test-component1:
extends: .test-template
rules:
- if: $CI_COMMIT_TAG
When the pipeline is executed, both jobs are in stage stage2
(remember: the job test-component1
should be in stage1
) and both jobs echos the text test2
. It seems as if the second include of the template overwrites the first one with all its values. What am I doing wrong? Or is it a bug?
Thanks in advance …