Merged PR 4735: Test PR for CI stuff
You can ignore me, I'm not important.
This commit is contained in:
commit
c44a099751
2 changed files with 20 additions and 11 deletions
|
|
@ -1,8 +1,7 @@
|
||||||
trigger:
|
trigger:
|
||||||
- master # Runs on each commit to master
|
branches:
|
||||||
|
include:
|
||||||
pr:
|
- master
|
||||||
- master # Runs on PRs targeting master
|
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
name: ci-pool-prd
|
name: ci-pool-prd
|
||||||
|
|
@ -14,24 +13,30 @@ steps:
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
cp ~/dbt-ci/.env .
|
cp ~/dbt-ci/.env .
|
||||||
echo "POSTGRES_DATABASE=${BUILD_SOURCEBRANCH#refs/heads/}" >> .env
|
|
||||||
|
# Check if it matches the refs/pull/<PR_ID>/merge pattern
|
||||||
|
if [[ $BUILD_SOURCEBRANCH =~ ^refs/pull/([0-9]+)/merge$ ]]; then
|
||||||
|
POSTGRES_DATABASE="ci_pr_${BASH_REMATCH[1]}"
|
||||||
|
else
|
||||||
|
POSTGRES_DATABASE="ci_${BUILD_SOURCEBRANCH#refs/heads/}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "POSTGRES_DATABASE: $POSTGRES_DATABASE"
|
||||||
|
|
||||||
|
echo "POSTGRES_DATABASE=${POSTGRES_DATABASE}" >> .env
|
||||||
set -a && source .env && set +a
|
set -a && source .env && set +a
|
||||||
displayName: 'Load env'
|
displayName: 'Load env'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
cp ~/dbt-ci/.env .
|
|
||||||
echo "POSTGRES_DATABASE=${BUILD_SOURCEBRANCH#refs/heads/}" >> .env
|
|
||||||
set -a && source .env && set +a
|
set -a && source .env && set +a
|
||||||
|
|
||||||
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "SELECT 1 FROM pg_database WHERE datname = 'postgres';"
|
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "SELECT 1 FROM pg_database WHERE datname = 'postgres';"
|
||||||
displayName: 'Smoke test Postgres connection'
|
displayName: 'Smoke test Postgres connection'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
cp ~/dbt-ci/.env .
|
|
||||||
echo "POSTGRES_DATABASE=${BUILD_SOURCEBRANCH#refs/heads/}" >> .env
|
|
||||||
set -a && source .env && set +a
|
set -a && source .env && set +a
|
||||||
|
|
||||||
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "CREATE DATABASE ci_${BUILD_SOURCEBRANCH#refs/heads/}"
|
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "CREATE DATABASE ${POSTGRES_DATABASE}"
|
||||||
displayName: 'Create branch dedicated database'
|
displayName: 'Create branch dedicated database'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
|
|
@ -65,7 +70,7 @@ steps:
|
||||||
- script: |
|
- script: |
|
||||||
set -a && source .env && set +a
|
set -a && source .env && set +a
|
||||||
|
|
||||||
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "DROP DATABASE ci_${BUILD_SOURCEBRANCH#refs/heads/}"
|
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "DROP DATABASE ${POSTGRES_DATABASE}"
|
||||||
condition: always()
|
condition: always()
|
||||||
displayName: 'Delete branch dedicated database'
|
displayName: 'Delete branch dedicated database'
|
||||||
|
|
||||||
|
|
@ -134,6 +134,10 @@ Once you build the docs with `run_docs.sh`, you will have a bunch of files. To o
|
||||||
|
|
||||||
This goes beyond the scope of this project: to understand how you can serve these, refer to our [infra script repo](https://guardhog.visualstudio.com/Data/_git/data-infra-script). Specifically, the bits around the web gateway set up.
|
This goes beyond the scope of this project: to understand how you can serve these, refer to our [infra script repo](https://guardhog.visualstudio.com/Data/_git/data-infra-script). Specifically, the bits around the web gateway set up.
|
||||||
|
|
||||||
|
## CI
|
||||||
|
|
||||||
|
TBD.
|
||||||
|
|
||||||
## Stuff that we haven't done but we would like to
|
## Stuff that we haven't done but we would like to
|
||||||
|
|
||||||
- Automate formatting with git pre-commit.
|
- Automate formatting with git pre-commit.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue