mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
DEVOPS-915 - Automate Staged Rollouts for Desktop (#3704)
This commit is contained in:
6
.github/workflows/build-web.yml
vendored
6
.github/workflows/build-web.yml
vendored
@@ -370,8 +370,8 @@ jobs:
|
|||||||
- cloc
|
- cloc
|
||||||
- setup
|
- setup
|
||||||
- build-artifacts
|
- build-artifacts
|
||||||
- build-containers
|
|
||||||
- build-commercial-selfhost-image
|
- build-commercial-selfhost-image
|
||||||
|
- build-containers
|
||||||
- crowdin-push
|
- crowdin-push
|
||||||
steps:
|
steps:
|
||||||
- name: Check if any job failed
|
- name: Check if any job failed
|
||||||
@@ -381,7 +381,7 @@ jobs:
|
|||||||
SETUP_STATUS: ${{ needs.setup.result }}
|
SETUP_STATUS: ${{ needs.setup.result }}
|
||||||
ARTIFACT_STATUS: ${{ needs.build-artifacts.result }}
|
ARTIFACT_STATUS: ${{ needs.build-artifacts.result }}
|
||||||
BUILD_SELFHOST_STATUS: ${{ needs.build-commercial-selfhost-image.result }}
|
BUILD_SELFHOST_STATUS: ${{ needs.build-commercial-selfhost-image.result }}
|
||||||
BUILD_QA_STATUS: ${{ needs.build-qa.result }}
|
BUILD_CONTAINERS_STATUS: ${{ needs.build-containers.result }}
|
||||||
CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }}
|
CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }}
|
||||||
run: |
|
run: |
|
||||||
if [ "$CLOC_STATUS" = "failure" ]; then
|
if [ "$CLOC_STATUS" = "failure" ]; then
|
||||||
@@ -392,7 +392,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
elif [ "$BUILD_SELFHOST_STATUS" = "failure" ]; then
|
elif [ "$BUILD_SELFHOST_STATUS" = "failure" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
elif [ "$BUILD_QA_STATUS" = "failure" ]; then
|
elif [ "$BUILD_CONTAINERS_STATUS" = "failure" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then
|
elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
71
.github/workflows/release-desktop.yml
vendored
71
.github/workflows/release-desktop.yml
vendored
@@ -13,13 +13,18 @@ on:
|
|||||||
- Initial Release
|
- Initial Release
|
||||||
- Redeploy
|
- Redeploy
|
||||||
- Dry Run
|
- Dry Run
|
||||||
|
rollout_percentage:
|
||||||
|
description: 'Staged Rollout Percentage'
|
||||||
|
required: true
|
||||||
|
default: '10'
|
||||||
|
type: string
|
||||||
snap_publish:
|
snap_publish:
|
||||||
description: 'Publish to snap store'
|
description: 'Publish to Snap store'
|
||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
choco_publish:
|
choco_publish:
|
||||||
description: 'Publish to chocolatey store'
|
description: 'Publish to Chocolatey store'
|
||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -93,23 +98,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
env:
|
uses: bitwarden/gh-actions/get-keyvault-secrets@c3b3285993151c5af47cefcb3b9134c28ab479af
|
||||||
KEYVAULT: bitwarden-prod-kv
|
with:
|
||||||
SECRETS: |
|
keyvault: "bitwarden-prod-kv"
|
||||||
aws-electron-access-id,
|
secrets: "aws-electron-access-id,
|
||||||
aws-electron-access-key,
|
aws-electron-access-key,
|
||||||
aws-electron-bucket-name,
|
aws-electron-bucket-name,
|
||||||
r2-electron-access-id,
|
r2-electron-access-id,
|
||||||
r2-electron-access-key,
|
r2-electron-access-key,
|
||||||
r2-electron-bucket-name,
|
r2-electron-bucket-name,
|
||||||
cf-prod-account
|
cf-prod-account"
|
||||||
run: |
|
|
||||||
for i in ${SECRETS//,/ }
|
|
||||||
do
|
|
||||||
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
|
||||||
echo "::add-mask::$VALUE"
|
|
||||||
echo "::set-output name=$i::$VALUE"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
@@ -135,6 +133,15 @@ jobs:
|
|||||||
working-directory: apps/desktop/artifacts
|
working-directory: apps/desktop/artifacts
|
||||||
run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive
|
run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive
|
||||||
|
|
||||||
|
- name: Set staged rollout percentage
|
||||||
|
env:
|
||||||
|
RELEASE_CHANNEL: ${{ steps.release-channel.outputs.channel }}
|
||||||
|
ROLLOUT_PCT: ${{ github.event.inputs.rollout_percentage }}
|
||||||
|
run: |
|
||||||
|
echo "stagingPercentage: ${ROLLOUT_PCT}" >> apps/desktop/artifacts/${RELEASE_CHANNEL}.yml
|
||||||
|
echo "stagingPercentage: ${ROLLOUT_PCT}" >> apps/desktop/artifacts/${RELEASE_CHANNEL}-linux.yml
|
||||||
|
echo "stagingPercentage: ${ROLLOUT_PCT}" >> apps/desktop/artifacts/${RELEASE_CHANNEL}-mac.yml
|
||||||
|
|
||||||
- name: Publish artifacts to S3
|
- name: Publish artifacts to S3
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
env:
|
env:
|
||||||
@@ -164,8 +171,8 @@ jobs:
|
|||||||
--quiet \
|
--quiet \
|
||||||
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
||||||
|
|
||||||
- name: Create release
|
- name: Create Release
|
||||||
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5
|
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09
|
||||||
if: ${{ steps.release-channel.outputs.channel == 'latest' && github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ steps.release-channel.outputs.channel == 'latest' && github.event.inputs.release_type != 'Dry Run' }}
|
||||||
env:
|
env:
|
||||||
PKG_VERSION: ${{ steps.version.outputs.version }}
|
PKG_VERSION: ${{ steps.version.outputs.version }}
|
||||||
@@ -236,17 +243,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
env:
|
uses: bitwarden/gh-actions/get-keyvault-secrets@c3b3285993151c5af47cefcb3b9134c28ab479af
|
||||||
KEYVAULT: bitwarden-prod-kv
|
with:
|
||||||
SECRETS: |
|
keyvault: "bitwarden-prod-kv"
|
||||||
snapcraft-store-token
|
secrets: "snapcraft-store-token"
|
||||||
run: |
|
|
||||||
for i in ${SECRETS//,/ }
|
|
||||||
do
|
|
||||||
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
|
||||||
echo "::add-mask::$VALUE"
|
|
||||||
echo "::set-output name=$i::$VALUE"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Install Snap
|
- name: Install Snap
|
||||||
uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0
|
uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0
|
||||||
@@ -293,7 +293,7 @@ jobs:
|
|||||||
_PKG_VERSION: ${{ needs.setup.outputs.release-version }}
|
_PKG_VERSION: ${{ needs.setup.outputs.release-version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||||
|
|
||||||
- name: Print Environment
|
- name: Print Environment
|
||||||
run: |
|
run: |
|
||||||
@@ -307,17 +307,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
env:
|
uses: bitwarden/gh-actions/get-keyvault-secrets@c3b3285993151c5af47cefcb3b9134c28ab479af
|
||||||
KEYVAULT: bitwarden-prod-kv
|
with:
|
||||||
SECRETS: |
|
keyvault: "bitwarden-prod-kv"
|
||||||
cli-choco-api-key
|
secrets: "cli-choco-api-key"
|
||||||
run: |
|
|
||||||
for i in ${SECRETS//,/ }
|
|
||||||
do
|
|
||||||
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
|
||||||
echo "::add-mask::$VALUE"
|
|
||||||
echo "::set-output name=$i::$VALUE"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Setup Chocolatey
|
- name: Setup Chocolatey
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|||||||
114
.github/workflows/staged-rollout-desktop.yml
vendored
114
.github/workflows/staged-rollout-desktop.yml
vendored
@@ -3,15 +3,121 @@ name: Staged Rollout Desktop
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
rollout_percentage:
|
||||||
|
description: 'Staged Rollout Percentage'
|
||||||
|
required: true
|
||||||
|
default: '10'
|
||||||
|
type: string
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
rollout:
|
||||||
name: Stub
|
name: Update Rollout Percentage
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
outputs:
|
||||||
|
release-version: ${{ steps.version.outputs.version }}
|
||||||
|
release-channel: ${{ steps.release-channel.outputs.channel }}
|
||||||
steps:
|
steps:
|
||||||
- name: TEST
|
- name: Login to Azure
|
||||||
run: exit 0
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
||||||
|
|
||||||
|
- name: Retrieve secrets
|
||||||
|
id: retrieve-secrets
|
||||||
|
uses: bitwarden/gh-actions/get-keyvault-secrets@c3b3285993151c5af47cefcb3b9134c28ab479af
|
||||||
|
with:
|
||||||
|
keyvault: "bitwarden-prod-kv"
|
||||||
|
secrets: "aws-electron-access-id,
|
||||||
|
aws-electron-access-key,
|
||||||
|
aws-electron-bucket-name,
|
||||||
|
r2-electron-access-id,
|
||||||
|
r2-electron-access-key,
|
||||||
|
r2-electron-bucket-name,
|
||||||
|
cf-prod-account"
|
||||||
|
|
||||||
|
- name: Download channel update info files from S3
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.aws-electron-access-id }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.aws-electron-access-key }}
|
||||||
|
AWS_DEFAULT_REGION: 'us-west-2'
|
||||||
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.aws-electron-bucket-name }}
|
||||||
|
run: |
|
||||||
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest.yml . \
|
||||||
|
--quiet
|
||||||
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest-linux.yml . \
|
||||||
|
--quiet
|
||||||
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest-mac.yml . \
|
||||||
|
--quiet
|
||||||
|
|
||||||
|
- name: Download channel update info files from R2
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.r2-electron-access-id }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.r2-electron-access-key }}
|
||||||
|
AWS_DEFAULT_REGION: 'us-east-1'
|
||||||
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.r2-electron-bucket-name }}
|
||||||
|
CF_ACCOUNT: ${{ steps.retrieve-secrets.outputs.cf-prod-account }}
|
||||||
|
run: |
|
||||||
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest.yml . \
|
||||||
|
--quiet \
|
||||||
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
||||||
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest-linux.yml . \
|
||||||
|
--quiet \
|
||||||
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
||||||
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest-mac.yml . \
|
||||||
|
--quiet \
|
||||||
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
||||||
|
|
||||||
|
- name: Check new rollout percentage
|
||||||
|
env:
|
||||||
|
NEW_PCT: ${{ github.event.inputs.rollout_percentage }}
|
||||||
|
run: |
|
||||||
|
CURRENT_PCT=$(sed -r -n "s/stagingPercentage:\s([0-9]+)/\1/p" latest.yml)
|
||||||
|
echo "Current percentage: ${CURRENT_PCT}"
|
||||||
|
echo "New percentage: ${NEW_PCT}"
|
||||||
|
echo
|
||||||
|
if [ "$NEW_PCT" -le "$CURRENT_PCT" ]; then
|
||||||
|
echo "New percentage (${NEW_PCT}) must be higher than current percentage (${CURRENT_PCT})!"
|
||||||
|
echo
|
||||||
|
echo "If you want to pull a staged release because it hasn’t gone well, you must increment the version \
|
||||||
|
number higher than your broken release. Because some of your users will be on the broken 1.0.1, \
|
||||||
|
releasing a new 1.0.1 would result in them staying on a broken version.”
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Set staged rollout percentage
|
||||||
|
env:
|
||||||
|
ROLLOUT_PCT: ${{ github.event.inputs.rollout_percentage }}
|
||||||
|
run: |
|
||||||
|
sed -i -r "/stagingPercentage/s/[0-9]+/${ROLLOUT_PCT}/" latest.yml
|
||||||
|
sed -i -r "/stagingPercentage/s/[0-9]+/${ROLLOUT_PCT}/" latest-linux.yml
|
||||||
|
sed -i -r "/stagingPercentage/s/[0-9]+/${ROLLOUT_PCT}/" latest-mac.yml
|
||||||
|
|
||||||
|
- name: Publish channel update info files to S3
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.aws-electron-access-id }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.aws-electron-access-key }}
|
||||||
|
AWS_DEFAULT_REGION: 'us-west-2'
|
||||||
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.aws-electron-bucket-name }}
|
||||||
|
run: |
|
||||||
|
aws s3 cp ./ $AWS_S3_BUCKET_NAME/desktop/ \
|
||||||
|
--include "latest*.yml" \
|
||||||
|
--acl "public-read" \
|
||||||
|
--quiet
|
||||||
|
|
||||||
|
- name: Publish channel update info files to R2
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.r2-electron-access-id }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.r2-electron-access-key }}
|
||||||
|
AWS_DEFAULT_REGION: 'us-east-1'
|
||||||
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.r2-electron-bucket-name }}
|
||||||
|
CF_ACCOUNT: ${{ steps.retrieve-secrets.outputs.cf-prod-account }}
|
||||||
|
run: |
|
||||||
|
aws s3 cp ./ $AWS_S3_BUCKET_NAME/desktop/ \
|
||||||
|
--include "latest*.yml" \
|
||||||
|
--quiet \
|
||||||
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
||||||
|
|||||||
Reference in New Issue
Block a user