-
Notifications
You must be signed in to change notification settings - Fork 4
107 lines (95 loc) · 4.25 KB
/
azure-ubuntu-22_04.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: "azure-08-build-toolset-image"
on:
workflow_dispatch:
inputs:
resourceGroupName:
description: "Name of the resource group to create for Shared Image Gallery"
required: true
default: "toolset"
jobs:
create-gallery-rg:
uses: ./.github/workflows/azure-resource-group.yml
with:
resourceGroupName: ${{ github.event.inputs.resourceGroupName }}
action: create
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
AZURE_REGION: ${{ secrets.AZURE_REGION }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}
create-shared-gallery-image-def:
uses: ./.github/workflows/azure-gallery.yml
needs: create-gallery-rg
with:
galleryName: toolsetvms
resourceGroupName: ${{ github.event.inputs.resourceGroupName }}
imageName: k8stoolsetvm
imageSku: "2023"
imagePublisher: workshop
imageOffer: 0000-com-vmware-k8s-toolset-vm
action: create
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}
build:
runs-on: ubuntu-22.04
needs: create-shared-gallery-image-def
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Copy init.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/init.sh"
target: "packer/azure/ubuntu/22_04/init.sh"
- name: Copy inventory.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/inventory.sh"
target: "packer/azure/ubuntu/22_04/inventory.sh"
- name: Copy kind-load-cafile.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/kind-load-cafile.sh"
target: "packer/azure/ubuntu/22_04/kind-load-cafile.sh"
- name: Copy fetch-tanzu-cli.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/fetch-tanzu-cli.sh"
target: "packer/azure/ubuntu/22_04/fetch-tanzu-cli.sh"
- name: Copy fetch-and-install-oci-cli.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/fetch-and-install-oci-cli.sh"
target: "packer/azure/ubuntu/22_04/fetch-and-install-oci-cli.sh"
- name: Copy install-tap-plugins.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/install-tap-plugins.sh"
target: "packer/azure/ubuntu/22_04/install-tap-plugins.sh"
- name: Copy install-krew-and-plugins.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/install-krew-and-plugins.sh"
target: "packer/azure/ubuntu/22_04/install-krew-and-plugins.sh"
- name: Use latest Packer
uses: hashicorp-contrib/setup-packer@v2
with:
packer-version: 1.9.4
- name: Initialize Packer
working-directory: ./packer/azure/ubuntu/22_04
run: packer init arm-ci.pkr.hcl
- name: Build image from template
working-directory: ./packer/azure/ubuntu/22_04
run: packer build -var image_name="k8stoolsetvm" -var resource_group="${{ github.event.inputs.resourceGroupName }}" -var subscription_id="${{ secrets.AZURE_SUBSCRIPTION_ID }}" -var tenant_id="${{ secrets.AZURE_AD_TENANT_ID }}" -var client_id="${{ secrets.AZURE_AD_CLIENT_ID }}" -var client_secret="${{ secrets.AZURE_AD_CLIENT_SECRET }}" -only="standard.*" arm-ci.pkr.hcl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}