Skip to content

Commit

Permalink
Add replication regions to Azure job (#64)
Browse files Browse the repository at this point in the history
* Add replication regions to Azure job

Signed-off-by: peterdeme <[email protected]>

* fix: removed `var.location`

* Remove location

---------

Signed-off-by: peterdeme <[email protected]>
  • Loading branch information
peterdeme authored Sep 23, 2024
1 parent 673cc48 commit 76f4aa9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build_gcp_azure_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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("");
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 12 additions & 7 deletions azure.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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, {
Expand All @@ -151,6 +152,10 @@ build {
"shared/scripts/apt-install-jq.sh",
"azure/scripts/azure-cli.sh",
]

env = {
DEBIAN_FRONTEND = "noninteractive"
}
}

# Deprovision VM
Expand Down
2 changes: 1 addition & 1 deletion azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 4 additions & 0 deletions gcp.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ build {
"shared/scripts/gvisor.sh",
"shared/scripts/apt-install-jq.sh",
]

env = {
DEBIAN_FRONTEND = "noninteractive"
}
}

post-processor "manifest" {
Expand Down

0 comments on commit 76f4aa9

Please sign in to comment.