From b0b723447a28290ae36df0de355d81d8b553a88c Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Mon, 27 Mar 2023 17:50:52 +0200 Subject: [PATCH] Add preprod deployment to release step --- bitbucket-pipelines.yml | 310 ++++++++++++++++++++-------------------- 1 file changed, 156 insertions(+), 154 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 8d45f9a5..b2e4a663 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -6,11 +6,9 @@ image: name: iterativ/skillbox-test@sha256:60d6bb808a9f0ff7b158192866a18eb7a5381a12621184c17bf5a4fb55384362 - clone: depth: full - definitions: services: postgres: @@ -22,171 +20,175 @@ definitions: cypress: $HOME/.cache/Cypress clientmodules: client/node_modules steps: - - &lint - name: lint - caches: - - clientmodules - script: - - npm install --prefix client - - npm run lint --prefix client - - &unittest-python - name: run python unit tests - caches: - - pip - services: - - postgres - script: # Modify the commands below to build your repository. - - &setup-tests source setup-for-tests.sh - - ./server/run_unittests_coverage.sh - - &cypress-test - name: run cypress end-to-end tests - caches: - - pip - - node - - clientmodules - - npm - - cypress - artifacts: - - client/cypress/**/*.png - - client/cypress/**/*.mp4 - services: - - postgres - script: - - echo "This pipeline rules!" - - *setup-tests - - npm ci --prefix client - - npm run "install:cypress" --prefix client - - psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME" - - python server/manage.py dummy_data - - python server/manage.py runserver 2>&1 > /dev/null & - - npm run build --prefix client - - curl http://localhost:8000/beta-login - - npm run --prefix client test:cypress:e2e - - &frontend-test - name: run cypress frontend tests - caches: - - node - - clientmodules - - npm - - cypress - artifacts: - - client/cypress/**/*.png - - client/cypress/**/*.mp4 - script: - - npm ci --prefix client - - npm run "install:cypress" --prefix client - - npm run dev --prefix client 2>&1 > /dev/null & - - sleep 30 - - curl http://localhost:8080/beta-login - - npm run --prefix client test:cypress:frontend - - &frontend-test-parallel - name: run cypress frontend tests - caches: - - node - - clientmodules - - npm - - cypress - artifacts: - - client/cypress/**/*.png - - client/cypress/**/*.mp4 - script: - - npm ci --prefix client - - npm run "install:cypress" --prefix client - - npm run dev --prefix client 2>&1 > /dev/null & - - sleep 30 - - curl http://localhost:8080/beta-login - - source bin/run-cypress-parallel.sh - - &jest-test - name: run jest tests - caches: - - node - - clientmodules - script: - - echo "This pipeline rules!" - - *setup-tests - - npm install --prefix client - - cd client - - npm run test:unit - - &deploy-dev - name: deploy to dev on Heroku - deployment: dev - trigger: manual - script: - - git push --force https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-dev.git HEAD:master - - &deploy-academy - name: deploy to iterativ-academy on Heroku - deployment: academy-stage - script: - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/iterativ-academy.git HEAD:master - - &deploy-stage - name: deploy to stage on Heroku - deployment: stage - script: - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-stage.git develop:master - - &deploy-preprod-manual - name: deploy to pre-prod environments on heroku - trigger: manual - deployment: preprod - script: - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-preprod.git HEAD:master - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-preprod.git HEAD:master - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-preprod.git HEAD:master - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-preprod.git HEAD:master - - &deploy-prod-manual - name: deploy to prod environments on heroku - trigger: manual - deployment: prod - script: - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-prod.git HEAD:master - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-prod.git HEAD:master - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-prod.git HEAD:master - - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-prod.git HEAD:master + - &lint + name: lint + caches: + - clientmodules + script: + - npm install --prefix client + - npm run lint --prefix client + - &unittest-python + name: run python unit tests + caches: + - pip + services: + - postgres + script: # Modify the commands below to build your repository. + - &setup-tests source setup-for-tests.sh + - ./server/run_unittests_coverage.sh + - &cypress-test + name: run cypress end-to-end tests + caches: + - pip + - node + - clientmodules + - npm + - cypress + artifacts: + - client/cypress/**/*.png + - client/cypress/**/*.mp4 + services: + - postgres + script: + - echo "This pipeline rules!" + - *setup-tests + - npm ci --prefix client + - npm run "install:cypress" --prefix client + - psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME" + - python server/manage.py dummy_data + - python server/manage.py runserver 2>&1 > /dev/null & + - npm run build --prefix client + - curl http://localhost:8000/beta-login + - npm run --prefix client test:cypress:e2e + - &frontend-test + name: run cypress frontend tests + caches: + - node + - clientmodules + - npm + - cypress + artifacts: + - client/cypress/**/*.png + - client/cypress/**/*.mp4 + script: + - npm ci --prefix client + - npm run "install:cypress" --prefix client + - npm run dev --prefix client 2>&1 > /dev/null & + - sleep 30 + - curl http://localhost:8080/beta-login + - npm run --prefix client test:cypress:frontend + - &frontend-test-parallel + name: run cypress frontend tests + caches: + - node + - clientmodules + - npm + - cypress + artifacts: + - client/cypress/**/*.png + - client/cypress/**/*.mp4 + script: + - npm ci --prefix client + - npm run "install:cypress" --prefix client + - npm run dev --prefix client 2>&1 > /dev/null & + - sleep 30 + - curl http://localhost:8080/beta-login + - source bin/run-cypress-parallel.sh + - &jest-test + name: run jest tests + caches: + - node + - clientmodules + script: + - echo "This pipeline rules!" + - *setup-tests + - npm install --prefix client + - cd client + - npm run test:unit + - &deploy-dev + name: deploy to dev on Heroku + deployment: dev + trigger: manual + script: + - git push --force https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-dev.git HEAD:master + - &deploy-academy + name: deploy to iterativ-academy on Heroku + deployment: academy-stage + script: + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/iterativ-academy.git HEAD:master + - &deploy-stage + name: deploy to stage on Heroku + deployment: stage + script: + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-stage.git develop:master + - &deploy-preprod-manual + name: deploy to pre-prod environments on heroku + trigger: manual + deployment: preprod + script: + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-preprod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-preprod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-preprod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-preprod.git HEAD:master + - &deploy-prod-manual + name: deploy to prod environments on heroku + trigger: manual + deployment: prod + script: + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-prod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-prod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-prod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-prod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-preprod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-preprod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-preprod.git HEAD:master + - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-preprod.git HEAD:master pipelines: default: - - parallel: - - step: *lint - - step: *unittest-python - - step: *cypress-test - - step: *frontend-test - - step: *jest-test - - step: *deploy-dev + - parallel: + - step: *lint + - step: *unittest-python + - step: *cypress-test + - step: *frontend-test + - step: *jest-test + - step: *deploy-dev branches: master: - - parallel: - - step: *unittest-python - - step: *cypress-test - - step: *frontend-test - - step: *jest-test - - step: *deploy-preprod-manual + - parallel: + - step: *unittest-python + - step: *cypress-test + - step: *frontend-test + - step: *jest-test + - step: *deploy-preprod-manual develop: - - parallel: - - step: *lint - - step: *unittest-python - - step: *cypress-test - - step: *frontend-test - - step: *jest-test - - parallel: - - step: *deploy-stage - - step: *deploy-academy - - step: *deploy-preprod-manual + - parallel: + - step: *lint + - step: *unittest-python + - step: *cypress-test + - step: *frontend-test + - step: *jest-test + - parallel: + - step: *deploy-stage + - step: *deploy-academy + - step: *deploy-preprod-manual tags: v202*: - parallel: - - step: *unittest-python - - step: *cypress-test - - step: *jest-test + - step: *unittest-python + - step: *cypress-test + - step: *jest-test - step: *deploy-prod-manual custom: cypress-parallel: - - parallel: - - step: *frontend-test-parallel - - step: *frontend-test-parallel - - step: *frontend-test-parallel - - step: *frontend-test-parallel - - step: *frontend-test-parallel - - step: *frontend-test-parallel + - parallel: + - step: *frontend-test-parallel + - step: *frontend-test-parallel + - step: *frontend-test-parallel + - step: *frontend-test-parallel + - step: *frontend-test-parallel + - step: *frontend-test-parallel