mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
QA deploy to CI push (#1119)
* updating the way we are deploying the web qa project * adding double quotes to try to fix the new image tag * trying the env var on a multi-line * fixed the git ref image name in the build workflow * fixing the the image tag in the qa deploy workflow * adding in the k8s namespace to the set image
This commit is contained in:
parent
f0678418d5
commit
77a401a931
34
.github/workflows/build.yml
vendored
34
.github/workflows/build.yml
vendored
@ -1,6 +1,11 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
custom_tag_extension:
|
||||||
|
description: "Custom image tag extension"
|
||||||
|
required: false
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- 'l10n_master'
|
- 'l10n_master'
|
||||||
@ -169,13 +174,11 @@ jobs:
|
|||||||
echo "GitHub event: $GITHUB_EVENT"
|
echo "GitHub event: $GITHUB_EVENT"
|
||||||
|
|
||||||
- name: Login to Azure
|
- name: Login to Azure
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
|
|
||||||
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
||||||
|
|
||||||
- name: Log into container registry
|
- name: Log into container registry
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
|
|
||||||
run: az acr login -n bitwardenqa
|
run: az acr login -n bitwardenqa
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
@ -198,28 +201,39 @@ jobs:
|
|||||||
docker --version
|
docker --version
|
||||||
docker build -t bitwardenqa.azurecr.io/web .
|
docker build -t bitwardenqa.azurecr.io/web .
|
||||||
|
|
||||||
- name: Tag rc branch
|
- name: Get image tag
|
||||||
if: github.ref == 'refs/heads/rc'
|
id: image_tag
|
||||||
run: docker tag bitwardenqa.azurecr.io/web bitwardenqa.azurecr.io/web:rc
|
run: |
|
||||||
|
IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}')
|
||||||
|
TAG_EXTENSION=${{ github.events.inputs.custom_tag_extension }}
|
||||||
|
|
||||||
|
if [[ $TAG_EXTENSION ]]; then
|
||||||
|
IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION
|
||||||
|
fi
|
||||||
|
echo "::set-output name=value::$IMAGE_TAG"
|
||||||
|
|
||||||
|
- name: Tag image
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: ${{ steps.image_tag.outputs.value }}
|
||||||
|
run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG"
|
||||||
|
|
||||||
- name: Tag dev
|
- name: Tag dev
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: docker tag bitwardenqa.azurecr.io/web bitwardenqa.azurecr.io/web:dev
|
run: docker tag bitwardenqa.azurecr.io/web bitwardenqa.azurecr.io/web:dev
|
||||||
|
|
||||||
- name: List Docker images
|
- name: List Docker images
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
|
|
||||||
run: docker images
|
run: docker images
|
||||||
|
|
||||||
- name: Push rc images
|
- name: Push image
|
||||||
if: github.ref == 'refs/heads/rc'
|
env:
|
||||||
run: docker push bitwardenqa.azurecr.io/web:rc
|
IMAGE_TAG: ${{ steps.image_tag.outputs.value }}
|
||||||
|
run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG"
|
||||||
|
|
||||||
- name: Push dev images
|
- name: Push dev images
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: docker push bitwardenqa.azurecr.io/web:dev
|
run: docker push bitwardenqa.azurecr.io/web:dev
|
||||||
|
|
||||||
- name: Log out of Docker
|
- name: Log out of Docker
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
|
|
||||||
run: docker logout
|
run: docker logout
|
||||||
|
|
||||||
|
|
||||||
|
28
.github/workflows/qa-deploy.yml
vendored
28
.github/workflows/qa-deploy.yml
vendored
@ -2,7 +2,10 @@ name: QA Deploy
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs: {}
|
inputs:
|
||||||
|
image_extension:
|
||||||
|
description: "Image tag extension"
|
||||||
|
required: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
QA_CLUSTER_RESOURCE_GROUP: "bitwarden-devops"
|
QA_CLUSTER_RESOURCE_GROUP: "bitwarden-devops"
|
||||||
@ -12,7 +15,7 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy QA Web Vault
|
name: Deploy QA Web
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
@ -28,7 +31,6 @@ jobs:
|
|||||||
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
|
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403
|
uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403
|
||||||
with:
|
with:
|
||||||
@ -49,8 +51,20 @@ jobs:
|
|||||||
echo "---az get-creds---"
|
echo "---az get-creds---"
|
||||||
az aks get-credentials -n $QA_CLUSTER_NAME -g $QA_CLUSTER_RESOURCE_GROUP
|
az aks get-credentials -n $QA_CLUSTER_NAME -g $QA_CLUSTER_RESOURCE_GROUP
|
||||||
|
|
||||||
- name: Redeploy Web image
|
- name: Get image tag
|
||||||
|
id: image_tag
|
||||||
run: |
|
run: |
|
||||||
POD_NAME=$(kubectl get po -n $QA_K8S_NAMESPACE -l app=$QA_K8S_APP_NAME -o jsonpath="{.items[0].metadata.name}")
|
IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}')
|
||||||
echo "Deleting pod: $POD_NAME"
|
TAG_EXTENSION=${{ github.events.inputs.image_extension }}
|
||||||
kubectl delete po -n bw-qa $POD_NAME
|
|
||||||
|
if [[ $TAG_EXTENSION ]]; then
|
||||||
|
IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION
|
||||||
|
fi
|
||||||
|
echo "::set-output name=value::$IMAGE_TAG"
|
||||||
|
|
||||||
|
- name: Deploy Web image
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: ${{ steps.image_tag.outputs.value }}
|
||||||
|
run: |
|
||||||
|
kubectl set image -n $QA_K8S_NAMESPACE deployment/web web=bitwardenqa.azurecr.io/web:$IMAGE_TAG --record
|
||||||
|
kubectl rollout status deployment/web -n $QA_K8S_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user