From e6f8d17be4178a4db8b91570241b2b1482bce782 Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Wed, 18 Oct 2023 13:38:14 -0700
Subject: [PATCH] Add python3.12 bookworm base images

This is probably of limited utility currently as we don't have any good
test platforms for running jobs on top of python3.12 outside of these
container images. That said this will ensure our base job setup works
with python3.12, and give early adopters the option of working with
python3.12 in this way.

Change-Id: Ief76c76e86c8cbae50e9fc7cb34356fa1c8e99a8
---
 .../docker-images/python-3.12-bookworm.yaml   | 183 ++++++++++++++++++
 zuul.d/project.yaml                           |  12 ++
 2 files changed, 195 insertions(+)
 create mode 100644 zuul.d/docker-images/python-3.12-bookworm.yaml

diff --git a/zuul.d/docker-images/python-3.12-bookworm.yaml b/zuul.d/docker-images/python-3.12-bookworm.yaml
new file mode 100644
index 0000000000..3ed6b7843a
--- /dev/null
+++ b/zuul.d/docker-images/python-3.12-bookworm.yaml
@@ -0,0 +1,183 @@
+# python-builder-3.12-bookworm jobs
+- job:
+    name: system-config-build-image-python-builder-3.12-bookworm
+    description: Build a python-builder-3.12-bookworm image.
+    parent: system-config-build-image
+    timeout: 3600
+    provides:
+      - python-builder-container-image
+      - python-builder-3.12-bookworm-container-image
+    vars: &python-builder_3_12_bookworm_vars
+      docker_images:
+        - context: docker/python-builder
+          repository: opendevorg/python-builder
+          tags:
+            - 3.12-bookworm
+          arch:
+            - linux/amd64
+            - linux/arm64
+          build_args:
+            - PYTHON_VERSION=3.12
+            - DEBIAN_VERSION=bookworm
+    files: &python-builder_3_12_bookworm_files
+      - docker/python-base/
+      - docker/python-builder/
+      - zuul.d/docker-images/python-3.12-bookworm.yaml
+
+- job:
+    name: system-config-upload-image-python-builder-3.12-bookworm
+    description: Build and upload a python-builder-3.12-bookworm image.
+    parent: system-config-upload-image
+    timeout: 3600
+    provides:
+      - python-builder-container-image
+      - python-builder-3.12-bookworm-container-image
+    vars: *python-builder_3_12_bookworm_vars
+    files: *python-builder_3_12_bookworm_files
+
+- job:
+    name: system-config-promote-image-python-builder-3.12-bookworm
+    description: Promote a previously published python-builder-3.12-bookworm image to latest.
+    parent: system-config-promote-image
+    vars: *python-builder_3_12_bookworm_vars
+    files: *python-builder_3_12_bookworm_files
+
+# python-base-3.12-bookworm jobs
+- job:
+    name: system-config-build-image-python-base-3.12-bookworm
+    description: Build a python-base-3.12-bookworm image.
+    parent: system-config-build-image
+    timeout: 3600
+    provides:
+      - python-base-container-image
+      - python-base-3.12-bookworm-container-image
+    vars: &python-base_3_12_bookworm_vars
+      docker_images:
+        - context: docker/python-base
+          repository: opendevorg/python-base
+          tags:
+            - 3.12-bookworm
+          arch:
+            - linux/amd64
+            - linux/arm64
+          build_args:
+            - PYTHON_VERSION=3.12
+            - DEBIAN_VERSION=bookworm
+    files: &python-base_3_12_bookworm_files
+      - docker/python-base/
+      - docker/python-builder/
+      - zuul.d/docker-images/python-3.12-bookworm.yaml
+
+- job:
+    name: system-config-upload-image-python-base-3.12-bookworm
+    description: Build and upload a python-base-3.12-bookworm image.
+    parent: system-config-upload-image
+    timeout: 3600
+    provides: python-base-3.12-bookworm-container-image
+    vars: *python-base_3_12_bookworm_vars
+    files: *python-base_3_12_bookworm_files
+
+- job:
+    name: system-config-promote-image-python-base-3.12-bookworm
+    description: Promote a previously published python-base-3.12-bookworm image to latest.
+    parent: system-config-promote-image
+    vars: *python-base_3_12_bookworm_vars
+    files: *python-base_3_12_bookworm_files
+
+# python-base-3.12-bookworm-debug jobs
+- job:
+    name: system-config-build-image-python-base-3.12-bookworm-debug
+    description: Build a python-base-3.12-bookworm debug image.
+    parent: system-config-build-image
+    timeout: 3600
+    provides:
+      - python-base-3.12-bookworm-debug-container-image
+    vars: &python-base_3_12_bookworm_debug_vars
+      docker_images:
+        - context: docker/python-base
+          repository: opendevorg/python-base
+          tags:
+            - 3.12-bookworm-debug
+          arch:
+            - linux/amd64
+            - linux/arm64
+          build_args:
+            - PYTHON_VERSION=3.12
+            - DEBIAN_VERSION=bookworm
+            # Blank here means not the default of "slim-"
+            - IMAGE_FLAVOR=
+    files: &python-base_3_12_bookworm_debug_files
+      - docker/python-base/
+      - docker/python-builder/
+      - zuul.d/docker-images/python-3.12-bookworm.yaml
+
+- job:
+    name: system-config-upload-image-python-base-3.12-bookworm-debug
+    description: Build and upload a python-base-3.12-bookworm debug image.
+    parent: system-config-upload-image
+    timeout: 3600
+    provides: python-base-3.12-bookworm-debug-container-image
+    vars: *python-base_3_12_bookworm_debug_vars
+    files: *python-base_3_12_bookworm_debug_files
+
+- job:
+    name: system-config-promote-image-python-base-3.12-bookworm-debug
+    description: Promote a previously published python-base-3.12-bookworm debug image to latest.
+    parent: system-config-promote-image
+    vars: *python-base_3_12_bookworm_debug_vars
+    files: *python-base_3_12_bookworm_debug_files
+
+# uwsgi-base-3.12-bookworm jobs
+- job:
+    name: system-config-build-image-uwsgi-base-3.12-bookworm
+    description: Build a uwsgi-base-3.12-bookworm image.
+    parent: system-config-build-image
+    timeout: 3600
+    requires: &uwsgi-base_3_12_bookworm_requires
+      - python-base-3.12-bookworm-container-image
+      - python-builder-3.12-bookworm-container-image
+    provides: uwsgi-base-3.12-bookworm-container-image
+    dependencies:
+      - name: system-config-build-image-python-base-3.12-bookworm
+        soft: true
+      - name: system-config-build-image-python-builder-3.12-bookworm
+        soft: true
+    vars: &uwsgi-base_3_12_bookworm_vars
+      docker_images:
+        - context: docker/uwsgi-base
+          repository: opendevorg/uwsgi-base
+          tags:
+            - 3.12-bookworm
+          arch:
+            - linux/amd64
+            - linux/arm64
+          build_args:
+            - PYTHON_VERSION=3.12
+            - DEBIAN_VERSION=bookworm
+    files: &uwsgi-base_3_12_bookworm_files
+      - docker/python-base/
+      - docker/python-builder/
+      - docker/uwsgi-base/
+      - zuul.d/docker-images/python-3.12-bookworm.yaml
+
+- job:
+    name: system-config-upload-image-uwsgi-base-3.12-bookworm
+    description: Build and upload a uwsgi-base-3.12-bookworm image.
+    parent: system-config-upload-image
+    timeout: 3600
+    provides: uwsgi-base-3.12-bookworm-container-image
+    requires: *uwsgi-base_3_12_bookworm_requires
+    dependencies:
+      - name: system-config-upload-image-python-base-3.12-bookworm
+        soft: true
+      - name: system-config-upload-image-python-builder-3.12-bookworm
+        soft: true
+    vars: *uwsgi-base_3_12_bookworm_vars
+    files: *uwsgi-base_3_12_bookworm_files
+
+- job:
+    name: system-config-promote-image-uwsgi-base-3.12-bookworm
+    description: Promote a previously published uwsgi-base-3.12-bookworm image to latest.
+    parent: system-config-promote-image
+    vars: *uwsgi-base_3_12_bookworm_vars
+    files: *uwsgi-base_3_12_bookworm_files
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index d4182cc413..1ce5d8c025 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -157,10 +157,14 @@
         - system-config-build-image-python-base-3.10-bookworm
         - system-config-build-image-python-base-3.11-bookworm
         - system-config-build-image-python-base-3.11-bookworm-debug
+        - system-config-build-image-python-base-3.12-bookworm
+        - system-config-build-image-python-base-3.12-bookworm-debug
         - system-config-build-image-python-builder-3.10-bookworm
         - system-config-build-image-python-builder-3.11-bookworm
+        - system-config-build-image-python-builder-3.12-bookworm
         - system-config-build-image-uwsgi-base-3.10-bookworm
         - system-config-build-image-uwsgi-base-3.11-bookworm
+        - system-config-build-image-uwsgi-base-3.12-bookworm
     check-arm64:
       jobs:
         - system-config-run-base-arm64
@@ -310,10 +314,14 @@
         - system-config-upload-image-python-base-3.10-bookworm
         - system-config-upload-image-python-base-3.11-bookworm
         - system-config-upload-image-python-base-3.11-bookworm-debug
+        - system-config-upload-image-python-base-3.12-bookworm
+        - system-config-upload-image-python-base-3.12-bookworm-debug
         - system-config-upload-image-python-builder-3.10-bookworm
         - system-config-upload-image-python-builder-3.11-bookworm
+        - system-config-upload-image-python-builder-3.12-bookworm
         - system-config-upload-image-uwsgi-base-3.10-bookworm
         - system-config-upload-image-uwsgi-base-3.11-bookworm
+        - system-config-upload-image-uwsgi-base-3.12-bookworm
     promote:
       jobs:
         - opendev-promote-docs
@@ -341,10 +349,14 @@
         - system-config-promote-image-python-base-3.10-bookworm
         - system-config-promote-image-python-base-3.11-bookworm
         - system-config-promote-image-python-base-3.11-bookworm-debug
+        - system-config-promote-image-python-base-3.12-bookworm
+        - system-config-promote-image-python-base-3.12-bookworm-debug
         - system-config-promote-image-python-builder-3.10-bookworm
         - system-config-promote-image-python-builder-3.11-bookworm
+        - system-config-promote-image-python-builder-3.12-bookworm
         - system-config-promote-image-uwsgi-base-3.10-bookworm
         - system-config-promote-image-uwsgi-base-3.11-bookworm
+        - system-config-promote-image-uwsgi-base-3.12-bookworm
 
         # NOTE: infra-prod-* jobs have a hierarchy below that ensure
         # they can run in parallel.  We are deliberately keeping their