mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-25 16:59:17 +01:00
DEVOPS-1826 Add sync-delete-destination-files flag to stop deleting remote files in Storage Accounts (#8200)
* DEVOPS-1826 ADD: sync-not-delete-destination-files flag to deployment workflow * DEVOPS-1826 REFACTOR: sync utility to delete destination files * DEVOPS-1826 FIX: sync-delete-destination-files step in deploy-web.yml * DEVOPS-1826 ADD: invert-sync-delete-destination-files option to deploy-web.yml * DEVOPS-1826 REFACTOR: deploy-web.yml with invert-default-sync-delete-destination-files-value * DEVOPS-1826 REFACTOR: sync-delete-destination-files value in deploy-web.yml * DEVOPS-1826 REFACTOR: debug mode default value
This commit is contained in:
parent
8e3a723908
commit
ed2bd7c900
32
.github/workflows/deploy-web.yml
vendored
32
.github/workflows/deploy-web.yml
vendored
@ -19,6 +19,10 @@ on:
|
||||
description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')"
|
||||
type: string
|
||||
default: main
|
||||
invert-default-sync-delete-destination-files-value:
|
||||
description: "Invert the default sync-delete-destination-files value"
|
||||
type: boolean
|
||||
default: false
|
||||
debug:
|
||||
description: "Debug mode"
|
||||
type: boolean
|
||||
@ -34,10 +38,14 @@ on:
|
||||
description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')"
|
||||
type: string
|
||||
default: main
|
||||
invert-default-sync-delete-destination-files-value:
|
||||
description: "Invert the default sync-delete-destination-files value"
|
||||
type: boolean
|
||||
default: false
|
||||
debug:
|
||||
description: "Debug mode"
|
||||
type: boolean
|
||||
default: false
|
||||
default: true
|
||||
|
||||
permissions:
|
||||
deployments: write
|
||||
@ -54,6 +62,7 @@ jobs:
|
||||
azure-login-creds: ${{ steps.config.outputs.azure-login-creds }}
|
||||
retrieve-secrets-keyvault: ${{ steps.config.outputs.retrieve-secrets-keyvault }}
|
||||
sync-utility: ${{ steps.config.outputs.sync-utility }}
|
||||
sync-delete-destination-files: ${{ steps.config.outputs.sync-delete-destination-files }}
|
||||
steps:
|
||||
- name: Configure
|
||||
id: config
|
||||
@ -61,6 +70,15 @@ jobs:
|
||||
ENV_NAME_LOWER=$(echo "${{ inputs.environment }}" | awk '{print tolower($0)}')
|
||||
echo "configuring the Web deploy for ${{ inputs.environment }}"
|
||||
echo "environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT
|
||||
|
||||
# Invert the default value for sync-delete-destination-files
|
||||
if [ ${{ inputs.invert-default-sync-delete-destination-files-value }} ]; then
|
||||
echo "sync-delete-destination-files=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# This is the default value for USQA, EUQA, USPROD, and EUPROD
|
||||
echo "sync-delete-destination-files=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
case ${{ inputs.environment }} in
|
||||
"USQA")
|
||||
echo "azure-login-creds=AZURE_KV_US_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
||||
@ -96,6 +114,13 @@ jobs:
|
||||
echo "environment-artifact=web-*-cloud-usdev.zip" >> $GITHUB_OUTPUT
|
||||
echo "environment-name=Web Vault - US Development Cloud" >> $GITHUB_OUTPUT
|
||||
echo "environment-url=http://vault.$ENV_NAME_LOWER.bitwarden.pw" >> $GITHUB_OUTPUT
|
||||
|
||||
if [ ${{ inputs.invert-default-sync-delete-destination-files-value }} ]; then
|
||||
echo "sync-delete-destination-files=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# This is the default value for USDEV
|
||||
echo "sync-delete-destination-files=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# Set the sync utility to use for deployment to the environment (az-sync or azcopy)
|
||||
@ -259,7 +284,8 @@ jobs:
|
||||
az storage blob sync \
|
||||
--source "./build" \
|
||||
--container '$web' \
|
||||
--connection-string "${{ steps.retrieve-secrets-az-sync.outputs.sa-bitwarden-web-vault-dev-key-temp }}"
|
||||
--connection-string "${{ steps.retrieve-secrets-az-sync.outputs.sa-bitwarden-web-vault-dev-key-temp }}" \
|
||||
--delete-destination=${{ needs.setup.outputs.sync-delete-destination-files }}
|
||||
|
||||
- name: Sync to Azure Storage Account using azcopy
|
||||
if: ${{ needs.setup.outputs.sync-utility == 'azcopy' }}
|
||||
@ -271,7 +297,7 @@ jobs:
|
||||
AZCOPY_TENANT_ID: ${{ steps.retrieve-secrets-azcopy.outputs.sp-bitwarden-web-vault-tenant }}
|
||||
run: |
|
||||
azcopy sync ./build 'https://${{ steps.retrieve-secrets-azcopy.outputs.sa-bitwarden-web-vault-name }}.blob.core.windows.net/$web/' \
|
||||
--delete-destination=true
|
||||
--delete-destination=${{ needs.setup.outputs.sync-delete-destination-files }}
|
||||
|
||||
- name: Debug sync logs
|
||||
if: ${{ inputs.debug }}
|
||||
|
Loading…
Reference in New Issue
Block a user