Skip to content

Commit

Permalink
linux: Build Debian 12 (bookworm) images
Browse files Browse the repository at this point in the history
  • Loading branch information
nbyavuz committed May 2, 2024
1 parent c695f11 commit 685ca7c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 23 deletions.
38 changes: 28 additions & 10 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ task:
SCRIPTS: scripts/linux_debian_*

matrix:
- env:
TASK_NAME: bookworm
- env:
TASK_NAME: bullseye
- env:
Expand Down Expand Up @@ -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

Expand All @@ -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 \
.
Expand All @@ -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:
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 3 additions & 1 deletion docker/linux_debian_bullseye_ci → docker/linux_debian_ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM debian:bullseye
ARG DEBIAN_RELEASE

FROM debian:${DEBIAN_RELEASE}

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
31 changes: 20 additions & 11 deletions packer/linux_debian.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand Down Expand Up @@ -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" {
Expand Down

0 comments on commit 685ca7c

Please sign in to comment.