Merged PR 4735: Test PR for CI stuff

You can ignore me, I'm not important.
This commit is contained in:
Pablo Martín 2025-03-19 14:34:26 +00:00
commit c44a099751
2 changed files with 20 additions and 11 deletions

View file

@ -1,8 +1,7 @@
trigger:
- master # Runs on each commit to master
pr:
- master # Runs on PRs targeting master
branches:
include:
- master
pool:
name: ci-pool-prd
@ -14,24 +13,30 @@ steps:
- script: |
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
displayName: 'Load env'
- script: |
cp ~/dbt-ci/.env .
echo "POSTGRES_DATABASE=${BUILD_SOURCEBRANCH#refs/heads/}" >> .env
set -a && source .env && set +a
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d postgres -c "SELECT 1 FROM pg_database WHERE datname = 'postgres';"
displayName: 'Smoke test Postgres connection'
- script: |
cp ~/dbt-ci/.env .
echo "POSTGRES_DATABASE=${BUILD_SOURCEBRANCH#refs/heads/}" >> .env
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'
- script: |
@ -65,7 +70,7 @@ steps:
- script: |
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()
displayName: 'Delete branch dedicated database'

View file

@ -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.
## CI
TBD.
## Stuff that we haven't done but we would like to
- Automate formatting with git pre-commit.