diff --git a/.github/workflows/pr-test.yaml b/.github/workflows/pr-test.yaml index 0d8deeb..71f150b 100644 --- a/.github/workflows/pr-test.yaml +++ b/.github/workflows/pr-test.yaml @@ -42,11 +42,17 @@ jobs: tenant-id: "3aa4a235-b6e2-48d5-9195-7fcf05b459b0" subscription-id: ${{matrix.target.subscription-id}} + - name: Generate image tag + id: tag + run: | + sha=${GITHUB_SHA::8} + ts=$(date +%s) + echo "tag=${GITHUB_REF_NAME}-${sha}-${ts}" >> $GITHUB_OUTPUT + - name: Build image env: AZURE_SUBSCRIPTION_ID: ${{matrix.target.subscription-id}} ACR_NAME: ${{matrix.target.acr-name}} - image_tag: ${{matrix.target.acr-name}}.azurecr.io/${IMAGE_NAME}:${GITHUB_REF_NAME}-${GITHUB_SHA::8}-$(date +%s) IMAGE_NAME: radix-vulnerability-scanner run: | echo az acr task run \ @@ -57,20 +63,9 @@ jobs: --file ${GITHUB_WORKSPACE}/Dockerfile \ --set DOCKER_REGISTRY=${ACR_NAME} \ --set BRANCH=${GITHUB_REF_NAME} \ - --set TAGS="--tag ${image_tag}" \ + --set TAGS="--tag ${ACR_NAME}.azurecr.io/${IMAGE_NAME}:${{steps.tag.outputs.tag}}" \ --set DOCKER_FILE_NAME=Dockerfile \ --set PUSH="--push" \ --set REPOSITORY_NAME=${IMAGE_NAME} \ --set CACHE="" \ --set CACHE_TO_OPTIONS="--cache-to=type=registry,ref=${ACR_NAME}.azurecr.io/${IMAGE_NAME}:radix-cache-${GITHUB_REF_NAME},mode=max" - -# -# az acr task run -# --subscription 16ede44b-1f74-40a5-b428-46cca9a5741b -# --name radix-image-builder-internal -# --registry radixdev -# --context /home/runner/work/radix-vulnerability-scanner/radix-vulnerability-scanner -# --file /home/runner/work/radix-vulnerability-scanner/radix-vulnerability-scanner/Dockerfile -# --set DOCKER_REGISTRY=radixdev -# --set BRANCH=39/merge -# --set TAGS=--tag radixdev.azurecr.io/${radix-vulnerability-scanner}:${GITHUB_REF_NAME}-${GITHUB_SHA::8}-$(date +%s) --set DOCKER_FILE_NAME=Dockerfile --set PUSH=--push --set REPOSITORY_NAME=radix-vulnerability-scanner --set CACHE= --set CACHE_TO_OPTIONS=--cache-to=type=registry,ref=radixdev.azurecr.io/radix-vulnerability-scanner:radix-cache-39/merge,mode=max