From c8df0a7dd3900a5db8be9fa6663aadc54682f16b Mon Sep 17 00:00:00 2001 From: peterdeme Date: Fri, 20 Sep 2024 19:44:43 +0200 Subject: [PATCH 1/3] Add replication regions to Azure job Signed-off-by: peterdeme --- .github/workflows/build_gcp_azure_manual.yml | 10 +++++----- .github/workflows/ci.yml | 2 +- azure.pkr.hcl | 17 ++++++++++++++++- gcp.pkr.hcl | 4 ++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_gcp_azure_manual.yml b/.github/workflows/build_gcp_azure_manual.yml index cf20c4b..34fd948 100644 --- a/.github/workflows/build_gcp_azure_manual.yml +++ b/.github/workflows/build_gcp_azure_manual.yml @@ -28,7 +28,7 @@ jobs: PKR_VAR_gallery_resource_group: rg-worker_images-public-westeurope PKR_VAR_gallery_name: spacelift_worker_images_public PKR_VAR_gallery_image_name: spacelift_worker_image - PKR_VAR_gallery_replication_regions: '["westeurope"]' + PKR_VAR_gallery_replication_regions: '["westeurope", "northeurope", "northcentralus", "eastus", "eastus2", "westus2", "westus3"]' PKR_VAR_gallery_image_version: 1.0.${{ github.run_number }} steps: @@ -169,10 +169,10 @@ jobs: console.log("## Azure"); console.log(""); - console.log(`- Publisher | \`spaceliftinc1625499025476\`.`); - console.log(`- Offer | \`spacelift_worker\`.`); - console.log(`- SKU | \`ubuntu_20_04\`.`); - console.log(`- Version | \`1.0.${process.env.RUN_NUMBER}\`.`); + console.log(`- Community Gallery Name | \`spacelift-40913cda-9bf9-4bcb-bf90-78fd83f30079\``); + console.log(`- Image name | \`spacelift_worker_image\``); + console.log(`- Version | \`1.0.${process.env.RUN_NUMBER}\``); + console.log(`- Resource ID | \`/CommunityGalleries/spacelift-40913cda-9bf9-4bcb-bf90-78fd83f30079/Images/spacelift_worker_image/Versions/1.0.${process.env.RUN_NUMBER}\``); console.log(""); console.log("## Google Cloud Platform"); console.log(""); diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a31155c..e54a8ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: PKR_VAR_gallery_resource_group: rg-worker_images-public-westeurope PKR_VAR_gallery_name: spacelift_worker_images_public PKR_VAR_gallery_image_name: spacelift_worker_image - PKR_VAR_gallery_replication_regions: '["westeurope"]' + PKR_VAR_gallery_replication_regions: '["westeurope", "northeurope", "northcentralus", "eastus", "eastus2", "westus2", "westus3"]' PKR_VAR_gallery_image_version: 1.0.${{ github.run_number }} steps: diff --git a/azure.pkr.hcl b/azure.pkr.hcl index 491c650..a5fb649 100644 --- a/azure.pkr.hcl +++ b/azure.pkr.hcl @@ -116,7 +116,18 @@ source "azure-arm" "spacelift" { gallery_name = var.gallery_name image_name = var.gallery_image_name image_version = var.gallery_image_version - replication_regions = var.gallery_replication_regions + + target_region { + name = var.location + } + + dynamic target_region { + for_each = var.gallery_replication_regions + + content { + name = target_region.value + } + } } os_type = "Linux" @@ -151,6 +162,10 @@ build { "shared/scripts/apt-install-jq.sh", "azure/scripts/azure-cli.sh", ] + + env = { + DEBIAN_FRONTEND = "noninteractive" + } } # Deprovision VM diff --git a/gcp.pkr.hcl b/gcp.pkr.hcl index 8d781cb..db7daa4 100644 --- a/gcp.pkr.hcl +++ b/gcp.pkr.hcl @@ -88,6 +88,10 @@ build { "shared/scripts/gvisor.sh", "shared/scripts/apt-install-jq.sh", ] + + env = { + DEBIAN_FRONTEND = "noninteractive" + } } post-processor "manifest" { From 538891be62c5484aefc1210f1ea92f69e1d25126 Mon Sep 17 00:00:00 2001 From: peterdeme Date: Mon, 23 Sep 2024 11:00:52 +0200 Subject: [PATCH 2/3] fix: removed `var.location` --- azure.pkr.hcl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/azure.pkr.hcl b/azure.pkr.hcl index a5fb649..a851302 100644 --- a/azure.pkr.hcl +++ b/azure.pkr.hcl @@ -117,10 +117,6 @@ source "azure-arm" "spacelift" { image_name = var.gallery_image_name image_version = var.gallery_image_version - target_region { - name = var.location - } - dynamic target_region { for_each = var.gallery_replication_regions From 2fa86c980970566b0b0c5b70f5e4e7161d3c39a6 Mon Sep 17 00:00:00 2001 From: peterdeme Date: Mon, 23 Sep 2024 11:25:32 +0200 Subject: [PATCH 3/3] Remove location --- azure.pkr.hcl | 6 ------ azure/README.md | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/azure.pkr.hcl b/azure.pkr.hcl index a851302..177575f 100644 --- a/azure.pkr.hcl +++ b/azure.pkr.hcl @@ -79,11 +79,6 @@ variable "source_image_sku" { default = "20_04-daily-lts-gen2" } -variable "location" { - type = string - default = "" -} - variable "vm_size" { type = string default = "Standard_B2S" @@ -134,7 +129,6 @@ source "azure-arm" "spacelift" { build_resource_group_name = var.packer_work_group - location = var.location vm_size = var.vm_size azure_tags = merge(var.additional_tags, { diff --git a/azure/README.md b/azure/README.md index 630cac5..d53c1b1 100644 --- a/azure/README.md +++ b/azure/README.md @@ -10,7 +10,7 @@ cd spacelift-worker-image packer build azure.pkr.hcl ``` -Override the defaults using `-var="location=westeurope"` +Override the defaults using `-var="variable-name=variable-value"` The variables are located in the `azure.pkr.hcl` file.