I want to create a common .deploy template.
Every job that inherits from this template should be able to add some custom script logic in between the script from the inherited template. But how?
Example:
.deploy
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- ...
script:
- touch .env
- echo "SOME_COMMON_KEY=VALUE" >> .env
- $$PSEUDOCODE / PLACE YOUR CUSTOM LOGIC HERE
- ssh -i $SSH_ -o "StrictHostKeyChecking=no" $USER@$SERVER
- scp -i $SSH docker-compose.yml .env $USER@$SERVER:~/test/
- ssh -i $SSH $USER@$SERVER "docker-compose up"...
deploy_test:
extends: .deploy
variables:
USER: test
SERVER: test
script:
#TODO how to add custom statements in place of the $$PSEUDOCODE ?
deploy_prod:
extends: .deploy
variables:
USER: prod
SERVER: prod
script:
#TODO how to add custom statements in place of the $$PSEUDOCODE ?
So how could I add some custom statements in place of the $$PSEUDOCODE line?