Refactor bitbucket pipelines for more reusability
This commit is contained in:
parent
c75c9d0b40
commit
ae6db9382a
|
|
@ -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,71 +38,90 @@ 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
|
||||||
|
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:
|
pipelines:
|
||||||
default:
|
default: *default-steps
|
||||||
- parallel:
|
branches:
|
||||||
- step:
|
develop:
|
||||||
<<: *e2e
|
- <<: *default-steps
|
||||||
- step:
|
- step:
|
||||||
<<: *e2e
|
<<: *deploy
|
||||||
- step:
|
name: deploy on develop branch url
|
||||||
name: python tests
|
master:
|
||||||
max-time: 15
|
- <<: *default-steps
|
||||||
services:
|
- step:
|
||||||
- postgres
|
<<: *deploy
|
||||||
caches:
|
name: deploy on master branch url
|
||||||
- vbvpip
|
- step:
|
||||||
script:
|
<<: *deploy
|
||||||
- source ./env/bitbucket/prepare_for_test.sh
|
deployment: dev
|
||||||
- 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
|
|
||||||
|
|
||||||
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:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue