Skip to content

Commit b23c11a

Browse files
author
Silvija Tovernic
committed
add: packer build
1 parent 7642253 commit b23c11a

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.github/workflows/packer-build-if-vm.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ jobs:
8181
with:
8282
version: ${{ env.PACKER_VERSION }}
8383

84-
- name: Packer init
84+
- name: Packer Init
8585
run: packer init images/packer/image-factory-vm
8686

87-
- name: Packer validate
88-
run: packer validate images/packer/image-factory-vm
87+
- name: Packer Build
88+
run: |
89+
packer build \
90+
-var "${{ secrets.AZURE_CLIENT_ID }}" \
91+
-var 'client_secret=${{ secrets.AZURE_CLIENT_SECRET }}' \
92+
-var 'tenant_id=${{ secrets.AZURE_TENANT_ID }}' \
93+
-var 'subscription_id=${{ secrets.AZURE_SUBSCRIPTION_ID }}' \
94+
images/packer/image-factory-vm

images/packer/image-factory-vm/azure.pkr.hcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ source "azure-arm" "vm" {
2323
resource_group = var.resource_group
2424
gallery_name = var.gallery_name
2525
image_name = "test-ubuntu-22.04"
26-
image_version = "1.0.0"
26+
image_version = var.gallery_image_version
2727
target_region {
2828
name = var.location
2929
}
3030
}
3131
}
32-
33-
# az sig image-definition create --resource-group "wp10-silvija-rg" --gallery-name "wp10silvijaACG" --gallery-image-definition "test-ubuntu-22.04" --publisher "Canonical" --offer "0001-com-ubuntu-server-jammy" --sku "22_04-lts-gen2" --os-type linux
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
location = "{{ env['AZURE_LOCATION'] }}"
22
resource_group = "{{ env['AZURE_RESOURCE_GROUP'] }}"
33
gallery_name = "{{ env['AZURE_ACG'] }}"
4+
gallery_image_version = "{{ env['IMAGE_VERSION'] }}"

images/packer/image-factory-vm/variables.pkr.hcl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ variable "resource_group" {
2525
variable "gallery_name" {
2626
type = string
2727
}
28+
29+
variable "gallery_image_version" {
30+
type = string
31+
}

0 commit comments

Comments
 (0)