mirror of
https://github.com/bitwarden/server.git
synced 2025-02-16 01:51:21 +01:00
Add database migrations to QA Deploy workflow (#1402)
* Update workflow for db migrations * Remove typo * Updating qa-deploy workflow for database migrations * Test DB migrations on test database * Remove test code * Test inputs as boolean * Update if statements to properly test for truth value * Fix typo * Add if to deploy so that it will execute always after database steps
This commit is contained in:
parent
b1d1607f50
commit
666e99225c
39
.github/workflows/qa-deploy.yml
vendored
39
.github/workflows/qa-deploy.yml
vendored
@ -52,7 +52,7 @@ jobs:
|
|||||||
npm --version
|
npm --version
|
||||||
gulp --version
|
gulp --version
|
||||||
|
|
||||||
- name: load env vars
|
- name: Load env vars
|
||||||
run: |
|
run: |
|
||||||
echo "Base Path: ${BASE_PATH}"
|
echo "Base Path: ${BASE_PATH}"
|
||||||
echo "Name: ${NAME}"
|
echo "Name: ${NAME}"
|
||||||
@ -105,29 +105,56 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
reset-db:
|
reset-db:
|
||||||
|
name: Reset Database
|
||||||
|
if: ${{ github.event.inputs.resetDb == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: Reset Test Data - Stub
|
- name: Reset Test Data - Stub
|
||||||
if: ${{ github.events.inputs.resetDb }} == "true"
|
|
||||||
run: |
|
run: |
|
||||||
echo "placeholder for cleaning DB"
|
echo "placeholder for cleaning DB"
|
||||||
echo "placeholder for loading test dataset"
|
echo "placeholder for loading test dataset"
|
||||||
|
|
||||||
|
|
||||||
update-db:
|
update-db:
|
||||||
if: ${{ github.events.inputs.migrateDb }} == "true"
|
name: Update Database
|
||||||
|
if: ${{ github.event.inputs.migrateDb == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: migrate db
|
- name: Checkout repo
|
||||||
if: ${{ github.events.inputs.resetDb }} == "true"
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||||
|
|
||||||
|
- name: Login to Azure
|
||||||
|
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
||||||
|
|
||||||
|
- name: Retrieve secrets
|
||||||
|
id: retrieve-secrets
|
||||||
|
uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403
|
||||||
|
with:
|
||||||
|
keyvault: "bitwarden-qa-kv"
|
||||||
|
secrets: "mssql-server-host,
|
||||||
|
mssql-admin-login,
|
||||||
|
mssql-admin-login-password"
|
||||||
|
|
||||||
|
- name: Migrate database
|
||||||
|
env:
|
||||||
|
MSSQL_HOST: ${{ steps.retrieve-secrets.outputs.mssql-server-host }}
|
||||||
|
MSSQL_USER: ${{ steps.retrieve-secrets.outputs.mssql-admin-login }}
|
||||||
|
MSSQL_PASS: ${{ steps.retrieve-secrets.outputs.mssql-admin-login-password }}
|
||||||
|
working-directory: ./util/Migrator/DbScripts
|
||||||
run: |
|
run: |
|
||||||
echo "placeholder for updateing DB"
|
echo "Running database migrations..."
|
||||||
|
for f in `ls -v ./*.sql`; do
|
||||||
|
sqlcmd -S $MSSQL_HOST -d vault -U $MSSQL_USER -P $MSSQL_PASS -I -i $f
|
||||||
|
done;
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: always()
|
||||||
needs:
|
needs:
|
||||||
- reset-db
|
- reset-db
|
||||||
- update-db
|
- update-db
|
||||||
|
Loading…
Reference in New Issue
Block a user