From 800a23f963886dcc96748597d3aae35d09619ad7 Mon Sep 17 00:00:00 2001 From: "Dylan H. Morris" Date: Wed, 12 Feb 2025 17:30:26 -0500 Subject: [PATCH] Use SP authentication in containers.yaml (#341) * Use SP authentication in containers.yaml * Update containers.yaml * Update delete-container-tag.yaml Fix warning * Format files * Update containers.yaml * Update containers.yaml --------- Co-authored-by: Damon Bayer --- .github/workflows/containers.yaml | 15 +++++++++++---- .github/workflows/delete-container-tag.yaml | 5 ++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/containers.yaml b/.github/workflows/containers.yaml index 6184ae96..e6a25604 100644 --- a/.github/workflows/containers.yaml +++ b/.github/workflows/containers.yaml @@ -20,16 +20,23 @@ jobs: name: Build and push image steps: + - name: Login to Azure + id: azure_login_2 + uses: azure/login@v2 + with: + creds: ${{ secrets.EDAV_STF_SERVICE_PRINCIPAL }} + + - name: Login to ACR + run: az acr login --name ${{ vars.CONTAINER_REGISTRY_NAME }} + - name: Build and push image id: build-push - uses: CDCgov/cfa-actions/twostep-container-build@v1.2.0 + uses: CDCgov/cfa-actions/twostep-container-build@v1.2.1 with: + registry: ${{ vars.CONTAINER_REGISTRY_NAME }}.azurecr.io/ container-file-1: ./Containerfile.dependencies container-file-2: ./Containerfile first-step-cache-key: docker-dependencies-${{ runner.os }}-${{ hashFiles('./Containerfile.dependencies') }} - registry: ${{ vars.CONTAINER_REGISTRY }} - username: ${{ vars.CONTAINER_REGISTRY_USERNAME }} - password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} image: ${{ env.IMAGE_NAME }} build-args-2: | TAG=${{ steps.image.outputs.tag }} diff --git a/.github/workflows/delete-container-tag.yaml b/.github/workflows/delete-container-tag.yaml index 996577d1..4e6ae8fe 100644 --- a/.github/workflows/delete-container-tag.yaml +++ b/.github/workflows/delete-container-tag.yaml @@ -4,7 +4,6 @@ on: delete: env: - REGISTRY: ${{ vars.CONTAINER_REGISTRY }} IMAGE_NAME: pyrenew-hew jobs: @@ -38,11 +37,11 @@ jobs: # Remove the image from the registry az acr repository delete \ --yes \ - --name ${{ env.REGISTRY }} \ + --name ${{ vars.CONTAINER_REGISTRY_NAME }} \ --image ${{ env.IMAGE_NAME }}:${{ steps.image-tag.outputs.tag }} # Remove the dependencies image from the registry az acr repository delete \ --yes \ - --name ${{ env.REGISTRY }} \ + --name ${{ vars.CONTAINER_REGISTRY_NAME }} \ --image ${{ env.IMAGE_NAME }}:dependencies-${{ steps.image-tag.outputs.tag }}