cicd: updated gitlab CI to deploy in multiple env

This commit is contained in:
plup 2020-03-15 17:11:16 +01:00
parent 86223fd9fc
commit 8588c91965
2 changed files with 73 additions and 42 deletions

View File

@ -1,89 +1,121 @@
image: node image: node:11
stages: stages:
- validate_features - integration
- prepare_release - acceptance
- validate_release - deployment
- deploy_production
## TESTING ## ## TESTING ##
## VALIDATION ## ## VALIDATION ##
deploy_features: deploy_test1:
stage: validate_features stage: integration
environment: environment:
name: integration name: test1
url: https://integration.startinblox.com url: https://test1.startinblox.com
script: script:
- echo 'Environment is not setup yet...' - echo "$APP_CONFIG_TEST1" > config.json
- echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test1@astral.startinblox.com:~/front/
only: only:
- feature/* - feature/*
when: manual when: manual
tags: tags:
- sib - deploy
deploy_review: deploy_test2:
stage: prepare_release stage: integration
environment: environment:
name: review name: test2
url: https://review.startinblox.com url: https://test2.startinblox.com
script: script:
- echo "$APP_CONFIG_PARIS_STG" > config.json - echo "$APP_CONFIG_TEST2" > config.json
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install - npm install
- npm run build - npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test-paris@ssh-test-paris.happy-dev.fr:~/staging/www/ - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test2@astral.startinblox.com:~/front/
only: only:
- dev - feature/*
when: manual when: manual
tags: tags:
- sib - deploy
deploy_staging: deploy_test3:
stage: validate_release stage: integration
environment: environment:
name: staging name: test3
url: https://staging.startinblox.com url: https://test3.startinblox.com
script: script:
- echo 'Environment is not setup yet...' - echo "$APP_CONFIG_TEST3" > config.json
- echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test3@astral.startinblox.com:~/front/
only:
- feature/*
when: manual
tags:
- deploy
deploy_stg1:
stage: acceptance
environment:
name: stg1
url: https://stg1.startinblox.com
script:
- echo "$APP_CONFIG_STG1" > config.json
- echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* stg1@astral.startinblox.com:~/front/
only: only:
- master - master
tags: tags:
- sib - deploy
## LIVE DEPLOYMENT ## deploy_stg2:
stage: acceptance
environment:
name: stg2
url: https://stg2.startinblox.com
script:
- echo "$APP_CONFIG_STG2" > config.json
- echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* stg2@astral.startinblox.com:~/front/
only:
- master
tags:
- deploy
## LIVE DEPLOYMENTS ##
deploy_nantes: deploy_nantes:
stage: deploy_production stage: deployment
environment: environment:
name: nantes name: nantes
url: https://nantes.happy-dev.fr url: https://nantes.happy-dev.fr
script: script:
- echo "$APP_CONFIG_NANTES" > config.json - echo 'Not happening yet...'
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test-paris@ssh-test-paris.happy-dev.fr:~/staging/www/
only: only:
- master - master
when: manual when: manual
tags: tags:
- sib - deploy
deploy_paris: deploy_paris:
stage: deploy_production stage: deployment
environment: environment:
name: paris name: paris
url: https://paris.happy-dev.fr url: https://paris.happy-dev.fr
script: script:
- echo "$APP_CONFIG_PARIS" > config.json - echo 'Not happening yet...'
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- npm install
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test-paris@ssh-test-paris.happy-dev.fr:~/www/
only: only:
- master - master
when: manual when: manual
tags: tags:
- sib - deploy

View File

@ -1 +0,0 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEw23THoFtbG25dkre20Zx03wTyGtmEiUTANGekdCmCymie9/oGgpwIfsqR3VysaUZqO/ObS8le//mVtQJhkKi4= deploy key