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
image: iterativ/vbv-lernwelt-bitbucket
## job definition for running Cypress tests in parallel
## job definitions
e2e: &e2e
name: cypress test worker
max-time: 45
@ -26,7 +26,6 @@ e2e: &e2e
- cypress/**/*.png
- cypress/**/*.mp4
deploy: &deploy
name: deploy
max-time: 30
@ -39,71 +38,90 @@ deploy: &deploy
- docker
script:
- 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:-}
- cat /tmp/caprover_app_url.txt
python-tests: &python-tests
name: python tests
max-time: 15
services:
- postgres
caches:
- vbvpip
script:
- source ./env/bitbucket/prepare_for_test.sh
- pip install -r server/requirements/requirements-dev.txt
- ./server/run_tests_coverage.sh
python-linting: &python-linting
name: python linting
max-time: 15
services:
- postgres
caches:
- vbvpip
script:
- source ./env/bitbucket/prepare_for_test.sh
- pip install -r server/requirements/requirements-dev.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 .
- ufmt check server
js-tests: &js-tests
name: js tests
max-time: 15
caches:
- node
- clientnode
script:
- cd client
- pwd
- npm install
- npm test
js-linting: &js-linting
name: js linting
max-time: 15
caches:
- node
- clientnode
script:
- cd client
- pwd
- npm install
- npm run prettier:check
- npm run lint
- npm run typecheck
default-steps: &default-steps
- step: *e2e
- step: *e2e
- step: *python-tests
- step: *python-linting
- step: *js-tests
- step: *js-linting
- step:
<<: *deploy
name: deploy feature
trigger: manual
# main pipelines definitions
pipelines:
default:
- parallel:
- step:
<<: *e2e
- step:
<<: *e2e
- step:
name: python tests
max-time: 15
services:
- postgres
caches:
- vbvpip
script:
- source ./env/bitbucket/prepare_for_test.sh
- pip install -r server/requirements/requirements-dev.txt
- ./server/run_tests_coverage.sh
- step:
name: python linting
max-time: 15
services:
- postgres
caches:
- vbvpip
script:
- source ./env/bitbucket/prepare_for_test.sh
- pip install -r server/requirements/requirements-dev.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 .
- ufmt check server
- step:
name: js tests
max-time: 15
caches:
- node
- clientnode
script:
- cd client
- pwd
- npm install
- npm test
- step:
name: js linting
max-time: 15
caches:
- node
- clientnode
script:
- cd client
- pwd
- npm install
- npm run prettier:check
- npm run lint
- npm run typecheck
- step:
<<: *deploy
name: deploy feature
trigger: manual
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:
v202*:
- step:
@ -115,11 +133,6 @@ pipelines:
name: deploy prod
deployment: prod
trigger: manual
branches:
develop:
- step:
<<: *deploy
deployment: dev
custom:
deploy-stage:
- step: