Skip to content

Commit

Permalink
Revert "feat(azure/arm): enable arm64 azure build" (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve authored Apr 18, 2023
1 parent cb69f97 commit 302702d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
12 changes: 4 additions & 8 deletions Jenkinsfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,18 @@ pipeline {
values 'amazon-ebs'
}
}
// Only build Ubuntu images for arm64 CPU in AWS (notValues)
// Do NOT build ARM images in Azure
exclude {
axis {
name 'cpu_architecture'
values 'arm64'
}
axis {
name 'agent_type'
notValues 'ubuntu-22.04'
}
axis {
name 'compute_type'
values 'amazon-ebs'
values 'azure-arm'
}
}
// Only build Ubuntu images for arm64 CPU in Azure (notValues)
// Only build Ubuntu images for arm64 CPU in AWS
exclude {
axis {
name 'cpu_architecture'
Expand All @@ -206,7 +202,7 @@ pipeline {
}
axis {
name 'compute_type'
values 'azure-arm'
values 'amazon-ebs'
}
}
// No build on Windows or Docker, not yet implemented
Expand Down
3 changes: 1 addition & 2 deletions build-jenkins-agent-ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ build {

post-processor "docker-tag" {
only = ["docker.ubuntu"]
# TODO specify architecture in image name with local.image_name
repository = format("%s/jenkins-agent-%s-%s",var.docker_namespace, var.agent_os_type, var.agent_os_version)
repository = "${var.docker_namespace}/${local.image_name}"
tags = [var.image_version, "latest"]
}
}
3 changes: 1 addition & 2 deletions locals.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ locals {
now_unix_timestamp = formatdate("YYYYMMDDhhmmss", timestamp())
agent = format("%s-%s", var.agent_os_type, var.agent_os_version)
agent_os_version_safe = replace(var.agent_os_version, ".", "_")
image_name = format("jenkins-agent-%s-%s-%s", var.agent_os_type, var.agent_os_version, var.architecture)
unique_image_name = format("%s-%s", local.image_name, local.now_unix_timestamp)
image_name = format("jenkins-agent-%s-%s", var.agent_os_type, var.agent_os_version)
aws_spot_instance_types = {
# 4 vCPU x86 / 16 GB / $0.1504 - https://aws.amazon.com/fr/ec2/instance-types/t3/#Product_Details
"amd64" = ["t3.xlarge", "t3a.xlarge", "t2.xlarge", "m6a.xlarge"]
Expand Down
9 changes: 5 additions & 4 deletions sources.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This source defines all the common settings for any AWS AMI (whatever Operating System)
source "amazon-ebs" "base" {
# must to be unique to avoid concurrent builds to conflict
ami_name = "${local.unique_image_name}"
ami_name = "${local.image_name}-${var.architecture}-${local.now_unix_timestamp}"
spot_instance_types = local.aws_spot_instance_types[var.architecture]
spot_price = "auto"
# Define custom rootfs for build to avoid later filesystem extension during agent startups
Expand All @@ -26,6 +25,7 @@ source "amazon-ebs" "base" {
# To improve audit and garbage collecting, we provide tags
tags = {
imageplatform = var.architecture
imagetype = local.image_name
timestamp = local.now_unix_timestamp
version = var.image_version
scm_ref = var.scm_ref
Expand All @@ -35,6 +35,7 @@ source "amazon-ebs" "base" {
# This source defines all the common settings for any Azure image (whatever Operating System)
source "azure-arm" "base" {
managed_image_name = local.image_name
managed_image_resource_group_name = local.azure_destination_resource_group

vm_size = local.azure_vm_size[var.architecture]
Expand All @@ -55,15 +56,15 @@ source "azure-arm" "base" {
subscription = var.azure_subscription_id
resource_group = local.azure_destination_resource_group
gallery_name = "${var.build_type}_packer_images"
# Not unique name defined in https://github.com/jenkins-infra/azure/blob/bfe56cb4f843b0c8029413090c383f7ac38dde2a/locals.tf#L4-L41
image_name = "${local.image_name}"
image_name = "${local.image_name}-${var.architecture}"
image_version = var.image_version
replication_regions = lookup(local.azure_galleries, "${var.build_type}_packer_images", [])
}

# To improve audit and garbage collecting, we provide tags
azure_tags = {
imageplatform = var.architecture
imagetype = local.image_name
timestamp = local.now_unix_timestamp
version = var.image_version
scm_ref = var.scm_ref
Expand Down

0 comments on commit 302702d

Please sign in to comment.