Currently in our project the gitlab-ci.yml includes a common template yml with default stages and job definitions. I want to include a stage and respective job specific to this project, which needs to run in between the stages defined in template yml. Below are the sample yml files which represent the scenario I am working on.
- .mvn-template.yml
stages:
- build
- static-analysis
- unit-test
- package
- integration-test
compile:
stage: build
tags:
- docker
artifacts:
paths:
- target/
expire_in: 14 days
script:
- mvn $MAVEN_CLI_OPTS compile
interruptible: true
//and job definitions for - static-analysis
// - unit-test
// - package
// - integration-test
- gitlab-ci.yml
include:
- project: 'xxx/common-pipeline'
ref: x.x.x
file: '/.mvn-template.yml'
...
Now I want include a new stage specific this project, say contract-testing, in between
- package
- integration-test
So the contract-testing should run after package and before integration-test.
As this is specific to this project I cannot include in common template. Thus needs to be included in gitlab-ci.yml.
Could not figure out how to do this. I earlier worked with GitHub and just recently started on project with GitLab.
Can I include the stage in common template but don't define respective job there. And include the Job definition in gitlab-ci.yml? Not sure if this is the correct way. Probably there could be better options to handle such scenario.
Please help.