|
|
|
@ -31,6 +31,9 @@ on: |
|
|
|
description: "Custom image tag extension" |
|
|
|
description: "Custom image tag extension" |
|
|
|
required: false |
|
|
|
required: false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
_AZ_REGISTRY: bitwardenprod.azurecr.io |
|
|
|
|
|
|
|
|
|
|
|
jobs: |
|
|
|
jobs: |
|
|
|
cloc: |
|
|
|
cloc: |
|
|
|
name: CLOC |
|
|
|
name: CLOC |
|
|
|
@ -65,8 +68,7 @@ jobs: |
|
|
|
build-artifacts: |
|
|
|
build-artifacts: |
|
|
|
name: Build artifacts |
|
|
|
name: Build artifacts |
|
|
|
runs-on: ubuntu-22.04 |
|
|
|
runs-on: ubuntu-22.04 |
|
|
|
needs: |
|
|
|
needs: setup |
|
|
|
- setup |
|
|
|
|
|
|
|
env: |
|
|
|
env: |
|
|
|
_VERSION: ${{ needs.setup.outputs.version }} |
|
|
|
_VERSION: ${{ needs.setup.outputs.version }} |
|
|
|
strategy: |
|
|
|
strategy: |
|
|
|
@ -146,13 +148,10 @@ jobs: |
|
|
|
matrix: |
|
|
|
matrix: |
|
|
|
include: |
|
|
|
include: |
|
|
|
- artifact_name: cloud-QA |
|
|
|
- artifact_name: cloud-QA |
|
|
|
registries: [bitwardenprod.azurecr.io, bitwardenqa.azurecr.io] |
|
|
|
|
|
|
|
image_name: web-qa-cloud |
|
|
|
image_name: web-qa-cloud |
|
|
|
- artifact_name: ee |
|
|
|
- artifact_name: ee |
|
|
|
registries: [bitwardenprod.azurecr.io, bitwardenqa.azurecr.io] |
|
|
|
|
|
|
|
image_name: web-ee |
|
|
|
image_name: web-ee |
|
|
|
- artifact_name: selfhosted-COMMERCIAL |
|
|
|
- artifact_name: selfhosted-COMMERCIAL |
|
|
|
registries: [bitwarden, bitwardenprod.azurecr.io, bitwardenqa.azurecr.io] |
|
|
|
|
|
|
|
image_name: web |
|
|
|
image_name: web |
|
|
|
env: |
|
|
|
env: |
|
|
|
_VERSION: ${{ needs.setup.outputs.version }} |
|
|
|
_VERSION: ${{ needs.setup.outputs.version }} |
|
|
|
@ -174,21 +173,25 @@ jobs: |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
########## ACRs ########## |
|
|
|
########## ACRs ########## |
|
|
|
- name: Login to Azure - QA |
|
|
|
- name: Login to Prod Azure |
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 |
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 |
|
|
|
with: |
|
|
|
with: |
|
|
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }} |
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} |
|
|
|
|
|
|
|
|
|
|
|
- name: Log into QA container registry |
|
|
|
- name: Log into Prod container registry |
|
|
|
run: az acr login -n bitwardenqa |
|
|
|
run: az acr login -n bitwardenprod |
|
|
|
|
|
|
|
|
|
|
|
- name: Login to Azure - Prod |
|
|
|
- name: Login to Azure - CI Subscription |
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 |
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 |
|
|
|
with: |
|
|
|
with: |
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} |
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} |
|
|
|
|
|
|
|
|
|
|
|
- name: Log into Prod container registry |
|
|
|
- name: Retrieve github PAT secrets |
|
|
|
run: az acr login -n bitwardenprod |
|
|
|
id: retrieve-secret-pat |
|
|
|
|
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f096207b7a2f31723165aee6ad03e91716686e78 |
|
|
|
|
|
|
|
with: |
|
|
|
|
|
|
|
keyvault: "bitwarden-ci" |
|
|
|
|
|
|
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope" |
|
|
|
|
|
|
|
|
|
|
|
- name: Download ${{ matrix.artifact_name }} artifact |
|
|
|
- name: Download ${{ matrix.artifact_name }} artifact |
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 |
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 |
|
|
|
@ -218,37 +221,17 @@ jobs: |
|
|
|
|
|
|
|
|
|
|
|
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT |
|
|
|
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT |
|
|
|
|
|
|
|
|
|
|
|
- name: Generate tag list |
|
|
|
|
|
|
|
id: tag-list |
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} |
|
|
|
|
|
|
|
PROJECT_NAME: ${{ matrix.image_name }} |
|
|
|
|
|
|
|
run: echo "tags=bitwardenqa.azurecr.io/${PROJECT_NAME}:${IMAGE_TAG},bitwardenprod.azurecr.io/${PROJECT_NAME}:${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########## Build Image ########## |
|
|
|
########## Build Image ########## |
|
|
|
- name: Extract artifact |
|
|
|
- name: Extract artifact |
|
|
|
working-directory: apps/web |
|
|
|
working-directory: apps/web |
|
|
|
run: unzip web-${{ env._VERSION }}-${{ matrix.artifact_name }}.zip |
|
|
|
run: unzip web-${{ env._VERSION }}-${{ matrix.artifact_name }}.zip |
|
|
|
|
|
|
|
|
|
|
|
- name: Login to Azure |
|
|
|
- name: Generate image full name |
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 |
|
|
|
id: image-name |
|
|
|
with: |
|
|
|
env: |
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} |
|
|
|
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} |
|
|
|
|
|
|
|
PROJECT_NAME: ${{ matrix.image_name }} |
|
|
|
- name: Retrieve github PAT secrets |
|
|
|
run: echo "name=$_AZ_REGISTRY/${PROJECT_NAME}:${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
id: retrieve-secret-pat |
|
|
|
|
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c |
|
|
|
|
|
|
|
with: |
|
|
|
|
|
|
|
keyvault: "bitwarden-ci" |
|
|
|
|
|
|
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Setup DCT |
|
|
|
|
|
|
|
if: ${{ env.is_publish_branch == 'true' }} |
|
|
|
|
|
|
|
id: setup-dct |
|
|
|
|
|
|
|
uses: bitwarden/gh-actions/setup-docker-trust@a30e9c3d658dc97c4c2e61ec749fdab64b83386c |
|
|
|
|
|
|
|
with: |
|
|
|
|
|
|
|
azure-creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} |
|
|
|
|
|
|
|
azure-keyvault-name: "bitwarden-ci" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build Docker image |
|
|
|
- name: Build Docker image |
|
|
|
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 |
|
|
|
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 |
|
|
|
@ -257,21 +240,10 @@ jobs: |
|
|
|
file: apps/web/Dockerfile |
|
|
|
file: apps/web/Dockerfile |
|
|
|
platforms: linux/amd64 |
|
|
|
platforms: linux/amd64 |
|
|
|
push: true |
|
|
|
push: true |
|
|
|
tags: ${{ steps.tag-list.outputs.tags }} |
|
|
|
tags: ${{ steps.image-name.outputs.name }} |
|
|
|
secrets: | |
|
|
|
secrets: | |
|
|
|
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}" |
|
|
|
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}" |
|
|
|
|
|
|
|
|
|
|
|
- name: Push to DockerHub |
|
|
|
|
|
|
|
if: contains(matrix.registries, 'bitwarden') && env.is_publish_branch == 'true' |
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} |
|
|
|
|
|
|
|
PROJECT_NAME: ${{ matrix.image_name }} |
|
|
|
|
|
|
|
DOCKER_CONTENT_TRUST: 1 |
|
|
|
|
|
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }} |
|
|
|
|
|
|
|
run: | |
|
|
|
|
|
|
|
docker tag bitwardenprod.azurecr.io/$PROJECT_NAME:$IMAGE_TAG bitwarden/$PROJECT_NAME:$IMAGE_TAG |
|
|
|
|
|
|
|
docker push bitwarden/$PROJECT_NAME:$IMAGE_TAG |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Log out of Docker |
|
|
|
- name: Log out of Docker |
|
|
|
run: docker logout |
|
|
|
run: docker logout |
|
|
|
|
|
|
|
|
|
|
|
@ -279,8 +251,7 @@ jobs: |
|
|
|
crowdin-push: |
|
|
|
crowdin-push: |
|
|
|
name: Crowdin Push |
|
|
|
name: Crowdin Push |
|
|
|
if: github.ref == 'refs/heads/master' |
|
|
|
if: github.ref == 'refs/heads/master' |
|
|
|
needs: |
|
|
|
needs: build-artifacts |
|
|
|
- build-artifacts |
|
|
|
|
|
|
|
runs-on: ubuntu-22.04 |
|
|
|
runs-on: ubuntu-22.04 |
|
|
|
steps: |
|
|
|
steps: |
|
|
|
- name: Checkout repo |
|
|
|
- name: Checkout repo |
|
|
|
|