forked from Azure/dev-box-images
-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (65 loc) · 2.74 KB
/
build_images.yml
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
72
73
74
75
76
77
78
79
name: Build Images
concurrency: ${{ github.ref }}
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(join(github.event.commits.*.message), '+nobuild')"
env:
RESOURCE_GROUP_NAME: aqovia-devbox
IDENTITY_NAME: aqovia-devcenter-identity
GALLARY_NAME: aqovia_compute_gallery
VNET_NAME: aqovia-devbox-builder-vnet
SUBNET_NAME: default
STORAGE_ACCOUNT_NAME: aqdevboxbuilderstrg
LOCATION: westeurope
steps:
- uses: actions/checkout@v2
- name: Login to Azure
run: az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
- name: Ensure Bicep
run: az bicep upgrade
- name: Update pre_build/main.parameters.json
uses: restackio/[email protected]
with:
file: ./resources/pre_build/main.parameters.json
fields: |
{
"identityName" : "${{env.IDENTITY_NAME}}",
"galleryName": "${{env.GALLARY_NAME}}" ,
"network.name": "${{env.VNET_NAME}}",
"network.subnetName": "${{env.SUBNET_NAME}}",
"storage.name": "${{env.STORAGE_ACCOUNT_NAME}}"
}
- name: Deploy Resource Group
working-directory: ./resources
run: az deployment sub create
--name "resource-group-deployment-${{ github.run_id }}"
--location "${{ env.LOCATION }}"
--template-file ./templates/resourceGroup/main.bicep
--parameters name="${{ env.RESOURCE_GROUP_NAME }}" location="${{ env.LOCATION }}"
- name: Deploy Bicep
working-directory: ./resources
run: az deployment group create
--name "pre-build-deployment-${{ github.run_id }}"
--resource-group ${{ env.RESOURCE_GROUP_NAME }}
--template-file ./pre_build/main.bicep
- name: Set subnet resource id as SUBNET_ID environment variable
run: |
subnetResourceId=$(az network vnet subnet list \
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
--vnet-name ${{ env.VNET_NAME }} \
--query "[?name=='${{ env.SUBNET_NAME }}'].id" \
--output tsv);
echo "SUBNET_ID=$subnetResourceId" >> $GITHUB_ENV
- name: Deploy Build ACI Containers
run: python "./builder/build.py" --async
--repository "${{ github.repositoryUrl }}"
--revision "${{ github.sha }}"
--token "${{ github.token }}"
--client-id "${{ secrets.AZURE_CLIENT_ID }}"
--client-secret "${{ secrets.AZURE_CLIENT_SECRET }}"
--storage-account "${{ env.STORAGE_ACCOUNT_NAME }}"
--subnet-id "${{ env.SUBNET_ID }}"