From 2e1df912327efe86f03401f069609dc1fc8b66df Mon Sep 17 00:00:00 2001
From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com>
Date: Tue, 10 Aug 2021 11:15:16 -0700
Subject: [PATCH] Update qa env (#1504)
* deploying directly to the production slot of the App Service
* Update Azure Service Bus package
* adding a app service shutdown to qa
* reverting QA env deploy change
* Update qa-deploy workflow with debugging statement
* Disable start/stop in QA deploy workflow
* Fix UserKdf and UserApiKey migrations to only update null values (#1494)
* Add proper New Relic NuGet package for .NET 5
* Test NewRelic changes
Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
---
.github/workflows/qa-deploy.yml | 150 ++-----------------
bitwarden_license/src/Portal/Portal.csproj | 4 +
bitwarden_license/src/Portal/newrelic.config | 6 +
bitwarden_license/src/Sso/Sso.csproj | 1 +
bitwarden_license/src/Sso/newrelic.config | 6 +
src/Admin/Admin.csproj | 1 +
src/Admin/newrelic.config | 6 +
src/Api/Api.csproj | 2 +-
src/Api/newrelic.config | 2 +-
src/Billing/Billing.csproj | 1 +
src/Billing/newrelic.config | 6 +
src/Core/Core.csproj | 2 +-
src/Events/Events.csproj | 4 +
src/Events/newrelic.config | 6 +
src/Identity/Identity.csproj | 8 +-
src/Identity/newrelic.config | 2 +-
16 files changed, 60 insertions(+), 147 deletions(-)
create mode 100644 bitwarden_license/src/Portal/newrelic.config
create mode 100644 bitwarden_license/src/Sso/newrelic.config
create mode 100644 src/Admin/newrelic.config
create mode 100644 src/Billing/newrelic.config
create mode 100644 src/Events/newrelic.config
diff --git a/.github/workflows/qa-deploy.yml b/.github/workflows/qa-deploy.yml
index 8c2b9b2e70..7c10ecdf96 100644
--- a/.github/workflows/qa-deploy.yml
+++ b/.github/workflows/qa-deploy.yml
@@ -152,6 +152,7 @@ jobs:
run: |
echo "Running database migrations..."
for f in `ls -v ./*.sql`; do
+ echo "Executing file: ${f}..."
sqlcmd -S $MSSQL_HOST -d vault -U $MSSQL_USER -P $MSSQL_PASS -I -i $f
done;
@@ -201,6 +202,12 @@ jobs:
echo "::add-mask::$webapp_name"
echo "::set-output name=webapp-name::$webapp_name"
+ - name: Stop App Service
+ if: false
+ env:
+ AZURE_RESOURCE_GROUP: "bw-qa-env"
+ run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group $AZURE_RESOURCE_GROUP
+
- name: Deploy App
uses: azure/webapps-deploy@798e43877120eda6a2a690a4f212c545e586ae31
with:
@@ -208,143 +215,8 @@ jobs:
slot-name: "staging"
package: ./${{ matrix.name }}.zip
-
- swap-identity:
- runs-on: ubuntu-latest
- needs: deploy
- steps:
- - name: Login to Azure
- uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
- with:
- creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
-
- - name: Retrieve secrets
- id: retrieve-secrets
+ - name: Start App Service
+ if: false
env:
- VAULT_NAME: "bitwarden-qa-kv"
- run: |
- identity_webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-identity-webapp-name --query value --output tsv)
- echo "::add-mask::$identity_webapp_name"
- echo "::set-output name=identity-webapp-name::$identity_webapp_name"
-
- - name: Start staging slot
- run: az webapp start --name ${{ steps.retrieve-secrets.outputs.identity-webapp-name }} --resource-group bitwarden-qa --slot staging
-
- - name: Make sure staging endpoint is alive
- run: |
- SUCCESS="no"
- while read OUTPUT
- do
- STATUS=$( curl -is https://${{ steps.retrieve-secrets.outputs.identity-webapp-name }}-staging.azurewebsites.net/.well-known/openid-configuration/jwks | head -1 )
- if [[ "$STATUS" == *"200 OK"* ]]; then
- echo "It is live!"
- SUCCESS="yes"
- break
- fi
- echo -e "STAUS=$STATUS\nRetrying: $OUTPUT"
- sleep 4;
- done < <(seq 15)
-
- if [[ "$SUCCESS" == "no" ]]; then
- exit 1
- fi
-
- - name: Swap Identity
- run: az webapp deployment slot swap -g bitwarden-qa -n ${{ steps.retrieve-secrets.outputs.identity-webapp-name }} --slot staging --target-slot production
-
- - name: Stop staging slot
- run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.identity-webapp-name }} --resource-group bitwarden-qa --slot staging
-
-
- swap-slots:
- runs-on: ubuntu-latest
- needs: swap-identity
- strategy:
- fail-fast: false
- matrix:
- include:
- - name: Api
- - name: Billing
- - name: Events
- - name: Sso
- - name: Portal
- steps:
- - name: Setup
- id: setup
- run: |
- NAME_LOWER=$(echo "${{ matrix.name }}" | awk '{print tolower($0)}')
- echo "::set-output name=name_lower::$NAME_LOWER"
-
- - name: Login to Azure
- uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
- with:
- creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
-
- - name: Retrieve secrets
- id: retrieve-secrets
- env:
- VAULT_NAME: "bitwarden-qa-kv"
- run: |
- webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-${{ steps.setup.outputs.name_lower }}-webapp-name --query value --output tsv)
- echo "::add-mask::$webapp_name"
- echo "::set-output name=webapp-name::$webapp_name"
-
- - name: Start staging slot
- run: az webapp start --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group bitwarden-qa --slot staging
-
- - name: Make sure staging endpoint is alive
- run: |
- SUCCESS="no"
- while read OUTPUT
- do
- STATUS=$( curl -is https://${{ steps.retrieve-secrets.outputs.webapp-name }}-staging.azurewebsites.net/alive | head -1 )
- if [[ "$STATUS" == *"200 OK"* ]]; then
- echo "It is live!"
- SUCCESS="yes"
- break
- fi
- echo -e "STAUS=$STATUS\nRetrying: $OUTPUT"
- sleep 4;
- done < <(seq 15)
-
- if [[ "$SUCCESS" == "no" ]]; then
- exit 1
- fi
-
- - name: Swap slots
- run: az webapp deployment slot swap -g bitwarden-qa -n ${{ steps.retrieve-secrets.outputs.webapp-name }} --slot staging --target-slot production
-
- - name: Stop staging slot
- run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group bitwarden-qa --slot staging
-
-
- swap-admin:
- runs-on: ubuntu-latest
- needs: swap-slots
- steps:
- - name: Login to Azure
- uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
- with:
- creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
-
- - name: Retrieve secrets
- id: retrieve-secrets
- env:
- VAULT_NAME: "bitwarden-qa-kv"
- run: |
- admin_webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-admin-webapp-name --query value --output tsv)
- echo "::add-mask::$admin_webapp_name"
- echo "::set-output name=admin-webapp-name::$admin_webapp_name"
-
- - name: Start staging slot
- run: az webapp start --name ${{ steps.retrieve-secrets.outputs.admin-webapp-name }} --resource-group bitwarden-qa --slot staging
-
- - name: Make sure staging endpoint is alive
- run: |
- sleep 60 # I don't think the admin portal has an alive endpoint
-
- - name: Swap Admin
- run: az webapp deployment slot swap -g bitwarden-qa -n ${{ steps.retrieve-secrets.outputs.admin-webapp-name }} --slot staging --target-slot production
-
- - name: Stop staging slot
- run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.admin-webapp-name }} --resource-group bitwarden-qa --slot staging
+ AZURE_RESOURCE_GROUP: "bw-qa-env"
+ run: az webapp start --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group $AZURE_RESOURCE_GROUP
diff --git a/bitwarden_license/src/Portal/Portal.csproj b/bitwarden_license/src/Portal/Portal.csproj
index cf861a8ffd..5bfaf967fc 100644
--- a/bitwarden_license/src/Portal/Portal.csproj
+++ b/bitwarden_license/src/Portal/Portal.csproj
@@ -8,4 +8,8 @@
+
+
+
+
diff --git a/bitwarden_license/src/Portal/newrelic.config b/bitwarden_license/src/Portal/newrelic.config
new file mode 100644
index 0000000000..7ed805d309
--- /dev/null
+++ b/bitwarden_license/src/Portal/newrelic.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/bitwarden_license/src/Sso/Sso.csproj b/bitwarden_license/src/Sso/Sso.csproj
index 6f29b203c6..d29721fb79 100644
--- a/bitwarden_license/src/Sso/Sso.csproj
+++ b/bitwarden_license/src/Sso/Sso.csproj
@@ -6,6 +6,7 @@
+
diff --git a/bitwarden_license/src/Sso/newrelic.config b/bitwarden_license/src/Sso/newrelic.config
new file mode 100644
index 0000000000..7ed805d309
--- /dev/null
+++ b/bitwarden_license/src/Sso/newrelic.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/Admin/Admin.csproj b/src/Admin/Admin.csproj
index 5fcedae053..3aa205e542 100644
--- a/src/Admin/Admin.csproj
+++ b/src/Admin/Admin.csproj
@@ -19,6 +19,7 @@
+
diff --git a/src/Admin/newrelic.config b/src/Admin/newrelic.config
new file mode 100644
index 0000000000..7ed805d309
--- /dev/null
+++ b/src/Admin/newrelic.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj
index 3a5b1847f5..566ee8776e 100644
--- a/src/Api/Api.csproj
+++ b/src/Api/Api.csproj
@@ -29,7 +29,7 @@
-
+
diff --git a/src/Api/newrelic.config b/src/Api/newrelic.config
index 0b17a5e4f2..7ed805d309 100644
--- a/src/Api/newrelic.config
+++ b/src/Api/newrelic.config
@@ -2,5 +2,5 @@
-
+
diff --git a/src/Billing/Billing.csproj b/src/Billing/Billing.csproj
index 58ffae213a..07c640f72e 100644
--- a/src/Billing/Billing.csproj
+++ b/src/Billing/Billing.csproj
@@ -11,6 +11,7 @@
+
diff --git a/src/Billing/newrelic.config b/src/Billing/newrelic.config
new file mode 100644
index 0000000000..7ed805d309
--- /dev/null
+++ b/src/Billing/newrelic.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
index 5367890044..65967c0c1d 100644
--- a/src/Core/Core.csproj
+++ b/src/Core/Core.csproj
@@ -33,7 +33,7 @@
-
+
diff --git a/src/Events/Events.csproj b/src/Events/Events.csproj
index 1b58c7f703..cb65ff97c8 100644
--- a/src/Events/Events.csproj
+++ b/src/Events/Events.csproj
@@ -9,4 +9,8 @@
+
+
+
+
diff --git a/src/Events/newrelic.config b/src/Events/newrelic.config
new file mode 100644
index 0000000000..7ed805d309
--- /dev/null
+++ b/src/Events/newrelic.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/Identity/Identity.csproj b/src/Identity/Identity.csproj
index 7c3ea2901b..483452f51d 100644
--- a/src/Identity/Identity.csproj
+++ b/src/Identity/Identity.csproj
@@ -5,12 +5,12 @@
false
-
-
-
-
+
+
+
+
diff --git a/src/Identity/newrelic.config b/src/Identity/newrelic.config
index 0b17a5e4f2..7ed805d309 100644
--- a/src/Identity/newrelic.config
+++ b/src/Identity/newrelic.config
@@ -2,5 +2,5 @@
-
+