Update Deploy Web Inputs (#8236)

* Switch from bool to string comparison

* Switching to a simpler boolean logic for file deletion
This commit is contained in:
Joseph Flinn 2024-03-06 20:07:54 -08:00 committed by GitHub
parent c52456cbb6
commit 1259890f17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 22 deletions

View File

@ -19,14 +19,14 @@ on:
description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')" description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')"
type: string type: string
default: main default: main
invert-default-sync-delete-destination-files-value: force-delete-destination:
description: "Invert the default sync-delete-destination-files value" description: "Delete remote files that are not found locally"
type: boolean type: boolean
default: false default: false
debug: debug:
description: "Debug mode" description: "Debug mode"
type: boolean type: boolean
default: false default: true
workflow_call: workflow_call:
inputs: inputs:
@ -38,8 +38,8 @@ on:
description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')" description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')"
type: string type: string
default: main default: main
invert-default-sync-delete-destination-files-value: force-delete-destination:
description: "Invert the default sync-delete-destination-files value" description: "Delete remote files that are not found locally"
type: boolean type: boolean
default: false default: false
debug: debug:
@ -71,14 +71,6 @@ jobs:
echo "configuring the Web deploy for ${{ inputs.environment }}" echo "configuring the Web deploy for ${{ inputs.environment }}"
echo "environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT 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 case ${{ inputs.environment }} in
"USQA") "USQA")
echo "azure-login-creds=AZURE_KV_US_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT echo "azure-login-creds=AZURE_KV_US_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
@ -114,13 +106,6 @@ jobs:
echo "environment-artifact=web-*-cloud-usdev.zip" >> $GITHUB_OUTPUT echo "environment-artifact=web-*-cloud-usdev.zip" >> $GITHUB_OUTPUT
echo "environment-name=Web Vault - US Development Cloud" >> $GITHUB_OUTPUT echo "environment-name=Web Vault - US Development Cloud" >> $GITHUB_OUTPUT
echo "environment-url=http://vault.$ENV_NAME_LOWER.bitwarden.pw" >> $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 esac
# Set the sync utility to use for deployment to the environment (az-sync or azcopy) # Set the sync utility to use for deployment to the environment (az-sync or azcopy)
@ -285,7 +270,7 @@ jobs:
--source "./build" \ --source "./build" \
--container '$web' \ --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 }} --delete-destination=${{ inputs.force-delete-destination }}
- name: Sync to Azure Storage Account using azcopy - name: Sync to Azure Storage Account using azcopy
if: ${{ needs.setup.outputs.sync-utility == 'azcopy' }} if: ${{ needs.setup.outputs.sync-utility == 'azcopy' }}
@ -297,7 +282,7 @@ jobs:
AZCOPY_TENANT_ID: ${{ steps.retrieve-secrets-azcopy.outputs.sp-bitwarden-web-vault-tenant }} AZCOPY_TENANT_ID: ${{ steps.retrieve-secrets-azcopy.outputs.sp-bitwarden-web-vault-tenant }}
run: | run: |
azcopy sync ./build 'https://${{ steps.retrieve-secrets-azcopy.outputs.sa-bitwarden-web-vault-name }}.blob.core.windows.net/$web/' \ azcopy sync ./build 'https://${{ steps.retrieve-secrets-azcopy.outputs.sa-bitwarden-web-vault-name }}.blob.core.windows.net/$web/' \
--delete-destination=${{ needs.setup.outputs.sync-delete-destination-files }} --compare-hash="MD5" --delete-destination=${{ inputs.force-delete-destination }} --compare-hash="MD5"
- name: Debug sync logs - name: Debug sync logs
if: ${{ inputs.debug }} if: ${{ inputs.debug }}