From 685ca7ccb7b3adecb11d948ac677d54cd9599e6c Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz Date: Wed, 1 May 2024 21:16:46 +0300 Subject: [PATCH] linux: Build Debian 12 (bookworm) images --- .cirrus.yml | 38 ++++++++++++++----- Makefile | 8 +++- ...nux_debian_bullseye_ci => linux_debian_ci} | 4 +- packer/linux_debian.pkr.hcl | 31 +++++++++------ 4 files changed, 58 insertions(+), 23 deletions(-) rename docker/{linux_debian_bullseye_ci => linux_debian_ci} (87%) diff --git a/.cirrus.yml b/.cirrus.yml index ce835b8..6683c85 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -110,6 +110,8 @@ task: SCRIPTS: scripts/linux_debian_* matrix: + - env: + TASK_NAME: bookworm - env: TASK_NAME: bullseye - env: @@ -281,10 +283,17 @@ task: platform: linux cpu: 2 memory: 8G - env: - IMAGE: linux_debian_bullseye_ci + matrix: + - env: + DOCKER_FILE: linux_debian_ci + IMAGE: linux_debian_${DEBIAN_RELEASE}_ci + matrix: + - env: + DEBIAN_RELEASE: bullseye + - env: + DEBIAN_RELEASE: bookworm - skip: $CIRRUS_LAST_GREEN_CHANGE != '' && $CIRRUS_CRON != 'regular-rebuild' && !changesInclude('.cirrus.yml', 'scripts/linux_debian*', 'docker/linux_debian_bullseye_ci') + skip: $CIRRUS_LAST_GREEN_CHANGE != '' && $CIRRUS_CRON != 'regular-rebuild' && !changesInclude('.cirrus.yml', 'scripts/linux_debian*', 'docker/linux_debian_ci') <<: *gcp_docker_auth_unix @@ -311,9 +320,10 @@ task: --platform linux/amd64 \ --build-arg DATE=$DATE \ --build-arg IMAGE_NAME=$IMAGE \ + --build-arg DEBIAN_RELEASE=$DEBIAN_RELEASE \ --tag $GCP_REPO/$IMAGE:latest \ --tag $GCP_REPO/$IMAGE:$DATE \ - -f docker/$IMAGE \ + -f docker/$DOCKER_FILE \ --push \ . @@ -322,8 +332,11 @@ task: task: name: 'Testing Container Image: ${IMAGE_NAME}' - env: - IMAGE_NAME: linux_debian_bullseye_ci + matrix: + - env: + IMAGE_NAME: linux_debian_bullseye_ci + - env: + IMAGE_NAME: linux_debian_bookworm_ci depends_on: - dockerbuild-${IMAGE_NAME} container: @@ -334,12 +347,17 @@ task: - env # Disabled linux/arm64, fails currently due to reasons outside of our control -#task: -# name: test-linux-container-arm64 +# task: +# name: 'Testing Arm Container Image: ${IMAGE_NAME}' +# matrix: +# - env: +# IMAGE_NAME: linux_debian_bullseye_ci +# - env: +# IMAGE_NAME: linux_debian_bookworm_ci # depends_on: -# - linux_debian_bullseye_ci +# - ${IMAGE_NAME} # arm_container: -# image: $GCP_REPO/linux_debian_bullseye_ci:latest +# image: $GCP_REPO/${IMAGE_NAME}:latest # test_script: # - uname -a # - xsltproc --version diff --git a/Makefile b/Makefile index f444da2..a045f92 100644 --- a/Makefile +++ b/Makefile @@ -9,12 +9,18 @@ pre-commit: -var "image_date=$(IMAGE_DATE)" \ -var "image_name=freebsd-13" \ packer/freebsd.pkr.hcl -# Debian +# Debian Bullseye packer validate \ -var gcp_project=pg-ci-images-dev \ -var "image_date=$(IMAGE_DATE)" \ -var "image_name=bullseye" \ packer/linux_debian.pkr.hcl +# Debian Bookworm + packer validate \ + -var gcp_project=pg-ci-images-dev \ + -var "image_date=$(IMAGE_DATE)" \ + -var "image_name=bookworm" \ + packer/linux_debian.pkr.hcl # Windows VM packer validate \ -var gcp_project=pg-ci-images-dev \ diff --git a/docker/linux_debian_bullseye_ci b/docker/linux_debian_ci similarity index 87% rename from docker/linux_debian_bullseye_ci rename to docker/linux_debian_ci index cb00f1a..df205a8 100644 --- a/docker/linux_debian_bullseye_ci +++ b/docker/linux_debian_ci @@ -1,4 +1,6 @@ -FROM debian:bullseye +ARG DEBIAN_RELEASE + +FROM debian:${DEBIAN_RELEASE} ENV DEBIAN_FRONTEND=noninteractive diff --git a/packer/linux_debian.pkr.hcl b/packer/linux_debian.pkr.hcl index a8a6300..3e4f0e8 100644 --- a/packer/linux_debian.pkr.hcl +++ b/packer/linux_debian.pkr.hcl @@ -6,37 +6,46 @@ locals { image_identity = "${var.image_name}-${var.image_date}" debian_gcp_images = [ + { + task_name = "bookworm" + zone = "us-west1-a" + machine = "t2d-standard-2" + source_image_family = "debian-12" + }, { task_name = "bullseye" zone = "us-west1-a" machine = "t2d-standard-2" + source_image_family = "debian-11" }, { task_name = "sid" zone = "us-west1-a" machine = "t2d-standard-2" + source_image_family = "debian-11" }, { task_name = "sid-newkernel" zone = "us-west1-a" machine = "t2d-standard-4" + source_image_family = "debian-11" }, { task_name = "sid-newkernel-uring" zone = "us-west1-a" machine = "t2d-standard-4" + source_image_family = "debian-11" }, ] } -source "googlecompute" "bullseye-vanilla" { +source "googlecompute" "debian-vanilla" { disk_size = "25" disk_type = "pd-ssd" preemptible = "true" project_id = var.gcp_project image_name = "${local.image_identity}" instance_name = "build-${local.image_identity}" - source_image_family = "debian-11" source_image_project_id = ["debian-cloud"] ssh_pty = "true" ssh_username = "packer" @@ -53,13 +62,13 @@ build { dynamic "source" { for_each = local.debian_gcp_images - labels = ["source.googlecompute.bullseye-vanilla"] + labels = ["source.googlecompute.debian-vanilla"] iterator = tag content { # can't reference local. / var. here?!? name = tag.value.task_name - + source_image_family = tag.value.source_image_family zone = tag.value.zone machine_type = tag.value.machine } @@ -97,18 +106,18 @@ build { inline = [ <<-SCRIPT tee /etc/apt/sources.list <<-EOF - deb http://deb.debian.org/debian bullseye main - deb-src http://deb.debian.org/debian bullseye main - deb http://security.debian.org/debian-security bullseye-security main - deb-src http://security.debian.org/debian-security bullseye-security main - deb http://deb.debian.org/debian bullseye-updates main - deb-src http://deb.debian.org/debian bullseye-updates main + deb http://deb.debian.org/debian ${source.name} main + deb-src http://deb.debian.org/debian ${source.name} main + deb http://security.debian.org/debian-security ${source.name}-security main + deb-src http://security.debian.org/debian-security ${source.name}-security main + deb http://deb.debian.org/debian ${source.name}-updates main + deb-src http://deb.debian.org/debian ${source.name}-updates main EOF apt-get update -y SCRIPT ] - only = ["googlecompute.bullseye"] + only = ["googlecompute.bullseye", "googlecompute.bookworm"] } provisioner "shell" {