I have a .gitlab-ci.yml file as below:
image: node:6.10.3
stages:
- ver
- init
- deploy
ver:
stage: ver
script:
- node --version
- whoami
init:
stage: init
script:
- npm cache clean
- rm -rf node-modules
- npm install
deploy_staging:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh-add <(echo "$STAGING_PRIVATE_KEY" | base64 --decode)
- git pull
- echo "deployed to staging server"
environment:
name: staging
url: MY SERVER
only:
- master
In Gitlab when I go to pipeline I am expecting to see 3 stages which are ver, init, and deploy. However, It only takes the first to stages and I don't see anything for deploy.
So using the only: master
statement in the deploy job you exclude that from being touched at all in other branches. Gitlab doesn't show it in the pipeline as it was never used for non-master branches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With