-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 2.42 KB
/
pr-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Test Pull request
on:
pull_request:
branches:
- main
permissions:
id-token: write
contents: read
jobs:
build-deploy:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target:
- name: "dev"
acr-name: "radixdev"
client-id: "1a292b18-2960-49a5-b429-c8a50349b5eb"
subscription-id: "16ede44b-1f74-40a5-b428-46cca9a5741b"
# - name: "playground"
# acr-name: "radixdev"
# client-id: "1a292b18-2960-49a5-b429-c8a50349b5eb"
# subscription-id: "16ede44b-1f74-40a5-b428-46cca9a5741b"
#
# - name: "platform"
# acr-name: "radixprod"
# client-id: "d1ee58e8-5896-48d9-a777-5418c3df9a58"
# subscription-id: "ded7ca41-37c8-4085-862f-b11d21ab341a"
#
# - name: "c2"
# acr-name: "radixc2prod"
# client-id: "d1ee58e8-5896-48d9-a777-5418c3df9a58"
# subscription-id: "ded7ca41-37c8-4085-862f-b11d21ab341a"
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
with:
client-id: ${{matrix.target.client-id}}
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_NAME: radix-vulnerability-scanner
run: |
echo az acr task run \
--subscription ${AZURE_SUBSCRIPTION_ID} \
--name radix-image-builder-internal \
--registry ${ACR_NAME} \
--context ${GITHUB_WORKSPACE} \
--file ${GITHUB_WORKSPACE}/Dockerfile \
--set DOCKER_REGISTRY=${ACR_NAME} \
--set BRANCH=${GITHUB_REF_NAME} \
--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"