I have a .gitlab-ci.yml
file that says:
include:
- project: 'my-proj/my-gitlab-ci'
ref: master
file: '/pipeline/gitlab-ci.yml'
Because of some "Inconvenience" I would like to override some specific stage that is defined on the above mentioned gitlab-ci.yml
file injected on my top level .gitlab-ci.yml
file. The plan
stage I am interested in has the following thing:
plan-dummy:
stage: plan
script:
- terraform plan -lock=false -var-file=vars/vars.tfvars
What I want to do is override the above on the main .gitlab-ci.yml
file such that only the script is executed as an override:
plan-dummy:
stage: plan
script:
- terraform refresh # This is the line I want to add as an additional step before next
- terraform plan -lock=false -var-file=vars/dev.tfvars
How do I achieve that without fiddling with the injected file? Yes, I know that alternative is to do dirty copy-paste from child file, but I don't want to do that.
Regards,
You can do the terraform refresh
in a before_script
part which will be executed before you script
:
plan-dummy:
extends: plan-dummy
before_script:
- terraform refresh