From 76f4aa98eb98d96019893b757936a65d1aba9430 Mon Sep 17 00:00:00 2001 From: Peter Deme Date: Mon, 23 Sep 2024 11:30:42 +0200 Subject: [PATCH] Add replication regions to Azure job (#64) * Add replication regions to Azure job Signed-off-by: peterdeme * fix: removed `var.location` * Remove location --------- Signed-off-by: peterdeme --- .github/workflows/build_gcp_azure_manual.yml | 10 +++++----- .github/workflows/ci.yml | 2 +- azure.pkr.hcl | 19 ++++++++++++------- azure/README.md | 2 +- gcp.pkr.hcl | 4 ++++ 5 files changed, 23 insertions(+), 14 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..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" @@ -116,7 +111,14 @@ 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 + + dynamic target_region { + for_each = var.gallery_replication_regions + + content { + name = target_region.value + } + } } os_type = "Linux" @@ -127,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, { @@ -151,6 +152,10 @@ build { "shared/scripts/apt-install-jq.sh", "azure/scripts/azure-cli.sh", ] + + env = { + DEBIAN_FRONTEND = "noninteractive" + } } # Deprovision VM 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. 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" {