Refactor bitbucket pipelines for more reusability

This commit is contained in:
Daniel Egger 2023-05-26 09:24:30 +02:00
parent c75c9d0b40
commit ae6db9382a
1 changed files with 80 additions and 67 deletions

View File

@ -1,7 +1,7 @@
# this test is based on the docker image described in env/bitbucket/Dockerfile # this test is based on the docker image described in env/bitbucket/Dockerfile
image: iterativ/vbv-lernwelt-bitbucket image: iterativ/vbv-lernwelt-bitbucket
## job definition for running Cypress tests in parallel ## job definitions
e2e: &e2e e2e: &e2e
name: cypress test worker name: cypress test worker
max-time: 45 max-time: 45
@ -26,7 +26,6 @@ e2e: &e2e
- cypress/**/*.png - cypress/**/*.png
- cypress/**/*.mp4 - cypress/**/*.mp4
deploy: &deploy deploy: &deploy
name: deploy name: deploy
max-time: 30 max-time: 30
@ -39,19 +38,10 @@ deploy: &deploy
- docker - docker
script: script:
- source ./env/bitbucket/prepare_for_deployment.sh - source ./env/bitbucket/prepare_for_deployment.sh
# it will by default take the branch name, when there is no provided parameter
- ./caprover_deploy.sh ${DEPLOY_ENVIRONMENT:-} - ./caprover_deploy.sh ${DEPLOY_ENVIRONMENT:-}
- cat /tmp/caprover_app_url.txt - cat /tmp/caprover_app_url.txt
python-tests: &python-tests
pipelines:
default:
- parallel:
- step:
<<: *e2e
- step:
<<: *e2e
- step:
name: python tests name: python tests
max-time: 15 max-time: 15
services: services:
@ -62,7 +52,8 @@ pipelines:
- source ./env/bitbucket/prepare_for_test.sh - source ./env/bitbucket/prepare_for_test.sh
- pip install -r server/requirements/requirements-dev.txt - pip install -r server/requirements/requirements-dev.txt
- ./server/run_tests_coverage.sh - ./server/run_tests_coverage.sh
- step:
python-linting: &python-linting
name: python linting name: python linting
max-time: 15 max-time: 15
services: services:
@ -75,7 +66,8 @@ pipelines:
- git-crypt status -e | sort > git-crypt-encrypted-files-check.txt && diff -w git-crypt-encrypted-files.txt git-crypt-encrypted-files-check.txt - git-crypt status -e | sort > git-crypt-encrypted-files-check.txt && diff -w git-crypt-encrypted-files.txt git-crypt-encrypted-files-check.txt
- trufflehog --exclude_paths trufflehog-exclude-patterns.txt --allow trufflehog-allow.json --entropy=True --max_depth=100 . - trufflehog --exclude_paths trufflehog-exclude-patterns.txt --allow trufflehog-allow.json --entropy=True --max_depth=100 .
- ufmt check server - ufmt check server
- step:
js-tests: &js-tests
name: js tests name: js tests
max-time: 15 max-time: 15
caches: caches:
@ -86,7 +78,8 @@ pipelines:
- pwd - pwd
- npm install - npm install
- npm test - npm test
- step:
js-linting: &js-linting
name: js linting name: js linting
max-time: 15 max-time: 15
caches: caches:
@ -99,11 +92,36 @@ pipelines:
- npm run prettier:check - npm run prettier:check
- npm run lint - npm run lint
- npm run typecheck - npm run typecheck
default-steps: &default-steps
- step: *e2e
- step: *e2e
- step: *python-tests
- step: *python-linting
- step: *js-tests
- step: *js-linting
- step: - step:
<<: *deploy <<: *deploy
name: deploy feature name: deploy feature
trigger: manual trigger: manual
# main pipelines definitions
pipelines:
default: *default-steps
branches:
develop:
- <<: *default-steps
- step:
<<: *deploy
name: deploy on develop branch url
master:
- <<: *default-steps
- step:
<<: *deploy
name: deploy on master branch url
- step:
<<: *deploy
deployment: dev
tags: tags:
v202*: v202*:
- step: - step:
@ -115,11 +133,6 @@ pipelines:
name: deploy prod name: deploy prod
deployment: prod deployment: prod
trigger: manual trigger: manual
branches:
develop:
- step:
<<: *deploy
deployment: dev
custom: custom:
deploy-stage: deploy-stage:
- step: - step: