From 279cb28e34ae42556c6b34d6716d4cb6204750f2 Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Wed, 21 Aug 2024 15:40:35 -0700
Subject: [PATCH] Add Noble packages to Docker mirror

Each Ubuntu and Debian release get a separate independent repository
(though served from the same AFS volume) which means we need to
explicitly add each release to reprepro when they occur. Now that we've
switched to Noble as our default nodeset it has become apparent we did
not do this for Noble's Docker packages.

Go ahead and add a debian docker noble mirror. Note that reprepro has a
*.log logrotate rule for all logs produced by reprepro so we don't need
to explicitly add a rule for the new log file. We also don't need a new
volume in AFS as a single deb-docker volume is used for all of these
repo mirrors.

We pin the tox-linters and buildset-registry jobs to jammy because they
don't currently run on Noble. Linters faile because we need to use newer
hacking whcih we'll do in a followup that cleans up new errors and the
registry fails due to the issue we are trying to fix in this very change
(need docker packages for noble).

Change-Id: I289f19a11539b490c3b7327d01d517948b95e072
---
 .../files/debian-docker-noble/config/distributions     | 10 ++++++++++
 .../reprepro/files/debian-docker-noble/config/options  |  6 ++++++
 .../reprepro/files/debian-docker-noble/config/updates  |  7 +++++++
 playbooks/roles/reprepro/tasks/docker.yaml             |  7 ++++++-
 zuul.d/project.yaml                                    |  8 ++++++--
 5 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100755 playbooks/roles/reprepro/files/debian-docker-noble/config/distributions
 create mode 100755 playbooks/roles/reprepro/files/debian-docker-noble/config/options
 create mode 100755 playbooks/roles/reprepro/files/debian-docker-noble/config/updates

diff --git a/playbooks/roles/reprepro/files/debian-docker-noble/config/distributions b/playbooks/roles/reprepro/files/debian-docker-noble/config/distributions
new file mode 100755
index 0000000000..1ee90ee74d
--- /dev/null
+++ b/playbooks/roles/reprepro/files/debian-docker-noble/config/distributions
@@ -0,0 +1,10 @@
+Origin: Docker
+Codename: noble
+Description: Docker Noble mirror
+Architectures: amd64 arm64
+Components: stable
+UDebComponents:
+Contents: .gz
+Update: debian-docker
+Log: /var/log/reprepro/debian-docker-noble.log
+
diff --git a/playbooks/roles/reprepro/files/debian-docker-noble/config/options b/playbooks/roles/reprepro/files/debian-docker-noble/config/options
new file mode 100755
index 0000000000..8d3a38bafd
--- /dev/null
+++ b/playbooks/roles/reprepro/files/debian-docker-noble/config/options
@@ -0,0 +1,6 @@
+basedir /afs/.openstack.org/mirror/deb-docker/noble
+keepunreferencedfiles
+noskipold
+export changed
+spacecheck none
+verbose
diff --git a/playbooks/roles/reprepro/files/debian-docker-noble/config/updates b/playbooks/roles/reprepro/files/debian-docker-noble/config/updates
new file mode 100755
index 0000000000..427f2a59ff
--- /dev/null
+++ b/playbooks/roles/reprepro/files/debian-docker-noble/config/updates
@@ -0,0 +1,7 @@
+Name: debian-docker
+Method: https://download.docker.com/linux/ubuntu/
+Components: stable
+UDebComponents: stable
+Architectures: amd64 arm64
+GetInRelease: no
+VerifyRelease: F273FCD8
diff --git a/playbooks/roles/reprepro/tasks/docker.yaml b/playbooks/roles/reprepro/tasks/docker.yaml
index 721fbf9d70..ab3a8c6d1e 100644
--- a/playbooks/roles/reprepro/tasks/docker.yaml
+++ b/playbooks/roles/reprepro/tasks/docker.yaml
@@ -28,11 +28,16 @@
   vars:
     _dir: 'debian-docker-jammy'
 
+- name: Copy Debian Docker Noble config
+  include_tasks: utils/copy-config.yaml
+  vars:
+    _dir: 'debian-docker-noble'
+
 # Beacuse they all live on the same volume, run in order
 - name: Install update cron jobs
   cron:
     name: 'Debian Docker reprepro mirror sync'
-    job: 'flock -n /var/run/reprepro/debian-docker.lock bash -c "for DISTRO in xenial bionic focal jammy; do reprepro-mirror-update /etc/reprepro/debian-docker-\$DISTRO mirror.deb-docker >>/var/log/reprepro/debian-docker-\$DISTRO-mirror.log 2>&1; done"'
+    job: 'flock -n /var/run/reprepro/debian-docker.lock bash -c "for DISTRO in xenial bionic focal jammy noble; do reprepro-mirror-update /etc/reprepro/debian-docker-\$DISTRO mirror.deb-docker >>/var/log/reprepro/debian-docker-\$DISTRO-mirror.log 2>&1; done"'
     state: present
     hour: '*/2'
     minute: '{{ 45 | random(seed=inventory_hostname) }}'
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index 6d6ec9a3c2..34ae0b80e4 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -5,9 +5,11 @@
     check:
       jobs:
         - opendev-tox-docs
-        - opendev-buildset-registry
+        - opendev-buildset-registry:
+            nodeset: ubuntu-jammy
         - tox-linters:
             timeout: 3600
+            nodeset: ubuntu-jammy
         - system-config-run-base
         - system-config-run-base-ansible-devel:
             voting: false
@@ -168,9 +170,11 @@
     gate:
       jobs:
         - opendev-tox-docs
-        - opendev-buildset-registry
+        - opendev-buildset-registry:
+            nodeset: ubuntu-jammy
         - tox-linters:
             timeout: 3600
+            nodeset: ubuntu-jammy
         - system-config-run-base
         - system-config-run-borg-backup
         - system-config-run-dns