forked from Azure/AgentBaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packer.mk
executable file
·68 lines (55 loc) · 2.69 KB
/
packer.mk
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
SHELL=/bin/bash -o pipefail
build-packer:
ifeq (${OS_SKU},Ubuntu)
ifeq (${MODE},gen2Mode)
@echo "${MODE}: Building with Hyper-v generation 2 VM"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-gen2.json
else ifeq (${MODE},sigMode)
@echo "${MODE}: Building with Hyper-v generation 1 VM and save to Shared Image Gallery"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-sig.json
else
@echo "${MODE}: Building with Hyper-v generation 1 VM and save to Classic Storage Account"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder.json
endif
else ifeq (${OS_SKU},CBLMariner)
ifeq (${MODE},gen2Mode)
@echo "${MODE}: Building with Hyper-v generation 2 VM and save to Classic Storage Account"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-mariner-gen2.json
else ifeq (${MODE},sigMode)
$(error sigMode not supported yet)
else
@echo "${MODE}: Building with Hyper-v generation 1 VM and save to Classic Storage Account"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-mariner.json
endif
else
$(error OS_SKU was invalid ${OS_SKU})
endif
build-packer-windows:
ifeq (${MODE},sigMode)
@echo "${MODE}: Building with Hyper-v generation 1 VM and save to Shared Image Gallery"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/windows-vhd-builder-sig.json
else
@echo "${MODE}: Building with Hyper-v generation 1 VM and save to Classic Storage Account"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/windows-vhd-builder.json
endif
init-packer:
@./vhdbuilder/packer/init-variables.sh
az-login:
az login --service-principal -u ${CLIENT_ID} -p ${CLIENT_SECRET} --tenant ${TENANT_ID}
az account set -s ${SUBSCRIPTION_ID}
run-packer: az-login
@packer version && ($(MAKE) -f packer.mk init-packer | tee packer-output) && ($(MAKE) -f packer.mk build-packer | tee -a packer-output)
run-packer-windows: az-login
@packer version && ($(MAKE) -f packer.mk init-packer | tee packer-output) && ($(MAKE) -f packer.mk build-packer-windows | tee -a packer-output)
az-copy: az-login
azcopy-preview copy "${OS_DISK_SAS}" "${CLASSIC_BLOB}${CLASSIC_SAS_TOKEN}" --recursive=true
cleanup: az-login
@./vhdbuilder/packer/cleanup.sh
generate-sas: az-login
@./vhdbuilder/packer/generate-vhd-publishing-info.sh
convert-sig-to-classic-storage-account-blob: az-login
@./vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh
windows-vhd-publishing-info: az-login
@./vhdbuilder/packer/generate-windows-vhd-publishing-info.sh
test-building-vhd: az-login
@./vhdbuilder/packer/test/run-test.sh