Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add replication regions to Azure job #64

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]'
peterdeme marked this conversation as resolved.
Show resolved Hide resolved
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
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A target region to store the image version in. The attribute supersedes replication_regions which is now considered deprecated. One or more target_region blocks can be specified for storing an imager version to various regions. In addition to specifying a region, a DiskEncryptionSetId can be specified for each target region to support multi-region disk encryption. At a minimum their must be one target region entry for the primary build region where the image version will be stored. Target region must only contain one entry matching the build region when using shallow replication.

}

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"
peterdeme marked this conversation as resolved.
Show resolved Hide resolved
}
}

post-processor "manifest" {
Expand Down