1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-30 07:44:50 -05:00

Change build to not use prod ACR for temp image storage

This commit is contained in:
Vince Grassia 2023-11-15 12:40:01 -05:00
parent 87c0c9742e
commit 9dbac79753
No known key found for this signature in database
GPG Key ID: 9AD7505E8448CC08
14 changed files with 62 additions and 44 deletions

View File

@ -212,34 +212,34 @@ jobs:
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
########## ACRs ########## ########## ACRs ##########
- name: Login to Azure - PROD Subscription # - name: Login to Azure - PROD 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_PROD_KV_CREDENTIALS }}
- name: Login to PROD ACR # - name: Login to PROD ACR
run: az acr login -n ${_AZ_REGISTRY%.azurecr.io} # run: az acr login -n ${_AZ_REGISTRY%.azurecr.io}
- name: Login to Azure - CI Subscription # - 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_KV_CI_SERVICE_PRINCIPAL }} # creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
- name: Retrieve github PAT secrets # - name: Retrieve github PAT secrets
id: retrieve-secret-pat # id: retrieve-secret-pat
uses: bitwarden/gh-actions/get-keyvault-secrets@main # uses: bitwarden/gh-actions/get-keyvault-secrets@main
with: # with:
keyvault: "bitwarden-ci" # keyvault: "bitwarden-ci"
secrets: "github-pat-bitwarden-devops-bot-repo-scope" # secrets: "github-pat-bitwarden-devops-bot-repo-scope"
- name: Generate image full name # - name: Generate image full name
id: image-name # id: image-name
run: | # run: |
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name # IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
if [[ "$IMAGE_TAG" == "master" ]]; then # if [[ "$IMAGE_TAG" == "master" ]]; then
IMAGE_TAG=dev # IMAGE_TAG=dev
fi # fi
echo "name=${_AZ_REGISTRY}/build:${IMAGE_TAG}" >> $GITHUB_OUTPUT # echo "name=${_AZ_REGISTRY}/build:${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Build Docker image - name: Build Docker image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
@ -250,10 +250,18 @@ jobs:
linux/amd64, linux/amd64,
linux/arm/v7, linux/arm/v7,
linux/arm64 linux/arm64
push: true # push: true
tags: ${{ steps.image-name.outputs.name }} outputs: type=docker,dest=/tmp/build.tar
secrets: | # tags: ${{ steps.image-name.outputs.name }}
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}" tags: build:latest
# secrets: |
# "GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}"
- name: Upload artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: build
path: /tmp/build.tar
build-docker: build-docker:
name: Build Docker images name: Build Docker images
@ -366,18 +374,28 @@ jobs:
PROJECT_NAME: ${{ steps.setup.outputs.project_name }} PROJECT_NAME: ${{ steps.setup.outputs.project_name }}
run: echo "name=${_AZ_REGISTRY}/${PROJECT_NAME}:${IMAGE_TAG}" >> $GITHUB_OUTPUT run: echo "name=${_AZ_REGISTRY}/${PROJECT_NAME}:${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Download build image artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build
path: /tmp
- name: Load build image
run: |
docker load --input /tmp/build.tar
docker image ls -a
- name: Build Docker image - name: Build Docker image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with: with:
build-args: | # build-args: |
BUILD_TAG=${{ steps.tag.outputs.image_tag }} # BUILD_TAG=${{ steps.tag.outputs.image_tag }}
context: ${{ matrix.base_path }}/${{ matrix.project_name }} context: ${{ matrix.base_path }}/${{ matrix.project_name }}
file: ${{ matrix.base_path }}/${{ matrix.project_name }}/Dockerfile file: ${{ matrix.base_path }}/${{ matrix.project_name }}/Dockerfile
platforms: | platforms: |
linux/amd64, linux/amd64,
linux/arm/v7, linux/arm/v7,
linux/arm64 linux/arm64
pull: true
push: true push: true
tags: ${{ steps.image-name.outputs.name }} tags: ${{ steps.image-name.outputs.name }}
secrets: | secrets: |

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #

View File

@ -2,7 +2,7 @@
# Build stage # # Build stage #
############################################### ###############################################
ARG BUILD_TAG=latest ARG BUILD_TAG=latest
FROM --platform=$BUILDPLATFORM bitwardenprod.azurecr.io/build:${BUILD_TAG} AS bitwarden-build FROM --platform=$BUILDPLATFORM build:${BUILD_TAG} AS bitwarden-build
############################################### ###############################################
# App stage # # App stage #