Merged in feature/refactor-bitbucket-pipelines (pull request #105)

Feature/refactor bitbucket pipelines
This commit is contained in:
Daniel Egger 2023-05-26 08:42:48 +00:00
commit c43ad9bcf1
3 changed files with 86 additions and 70 deletions

View File

@ -151,8 +151,12 @@ When you run caprover_deploy.sh without arguments, it will deploy the current br
### Cleanup caprover feature branch deployments
```
```bash
# by default it will delete all vbv-feature-* apps
python caprover_cleanup.py
# or specify a specific app regex and delete without confirmation
python caprover_cleanup.py --automated -a 'vbv-bugfix*'
```
## IntelliJ Configuration

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,91 @@ 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
- parallel:
- 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 +134,6 @@ pipelines:
name: deploy prod
deployment: prod
trigger: manual
branches:
develop:
- step:
<<: *deploy
deployment: dev
custom:
deploy-stage:
- step:

View File

@ -7,8 +7,6 @@ from environs import Env
logging.basicConfig(level=logging.DEBUG)
env = Env()
env.read_env("./env_secrets/caprover_feature.env", recurse=False, override=True)
app_name = "vbv-feature-caprover-auto-deploy4"
cap = caprover_api.CaproverAPI(
dashboard_url=env.str("CAPROVER_DOMAIN"),