From f64d041ca29f7075f45d8519700cee676eb40691 Mon Sep 17 00:00:00 2001
From: Corey Bryant <corey.bryant@canonical.com>
Date: Fri, 10 Jun 2022 20:14:47 +0000
Subject: [PATCH] Add Kinetic and Zed support

* sync charm-helpers to classic charms
* change openstack-origin/source default to zed
* align testing with zed
* add new zed bundles
* add zed bundles to tests.yaml
* add zed tests to osci.yaml and .zuul.yaml
* update build-on and run-on bases
* add bindep.txt for py310
* sync tox.ini and requirements.txt for ruamel
* use charmcraft_channel 2.0/stable
* drop reactive plugin overrides
* move interface/layer env vars to charmcraft.yaml

Change-Id: I5bf1b2a030c08461bc42c1e686af6220738ed98c
---
 .zuul.yaml                                    |  2 +-
 bindep.txt                                    |  4 ++++
 charmcraft.yaml                               |  8 +++----
 metadata.yaml                                 |  2 +-
 osci.yaml                                     |  5 ++---
 test-requirements.txt                         | 17 +-------------
 tests/bundles/jammy-yoga.yaml                 | 18 +++++++--------
 .../{focal-yoga.yaml => jammy-zed.yaml}       | 22 +++++++++----------
 .../{focal-xena.yaml => kinetic-zed.yaml}     | 22 +++++++++----------
 tests/tests.yaml                              |  9 ++++----
 tox.ini                                       |  2 +-
 11 files changed, 50 insertions(+), 61 deletions(-)
 create mode 100644 bindep.txt
 rename tests/bundles/{focal-yoga.yaml => jammy-zed.yaml} (94%)
 rename tests/bundles/{focal-xena.yaml => kinetic-zed.yaml} (95%)

diff --git a/.zuul.yaml b/.zuul.yaml
index 7ffc71c..23bf5f6 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,4 +1,4 @@
 - project:
     templates:
-      - openstack-python3-charm-yoga-jobs
+      - openstack-python3-charm-zed-jobs
       - openstack-cover-jobs
diff --git a/bindep.txt b/bindep.txt
new file mode 100644
index 0000000..17575d9
--- /dev/null
+++ b/bindep.txt
@@ -0,0 +1,4 @@
+libffi-dev [platform:dpkg]
+libpq-dev [platform:dpkg]
+libxml2-dev [platform:dpkg]
+libxslt1-dev [platform:dpkg]
diff --git a/charmcraft.yaml b/charmcraft.yaml
index bea920d..192062a 100644
--- a/charmcraft.yaml
+++ b/charmcraft.yaml
@@ -22,13 +22,13 @@ parts:
 bases:
   - build-on:
       - name: ubuntu
-        channel: "20.04"
+        channel: "22.04"
         architectures:
           - amd64
     run-on:
-      - name: ubuntu
-        channel: "20.04"
-        architectures: [amd64, s390x, ppc64el, arm64]
       - name: ubuntu
         channel: "22.04"
         architectures: [amd64, s390x, ppc64el, arm64]
+      - name: ubuntu
+        channel: "22.10"
+        architectures: [amd64, s390x, ppc64el, arm64]
diff --git a/metadata.yaml b/metadata.yaml
index dd7e7a4..7860105 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -16,8 +16,8 @@ tags:
   - storage
   - file-servers
 series:
-  - focal
   - jammy
+  - kinetic
 subordinate: true
 provides:
   manila-plugin:
diff --git a/osci.yaml b/osci.yaml
index 5aa89fb..c17aecb 100644
--- a/osci.yaml
+++ b/osci.yaml
@@ -1,14 +1,13 @@
 - project:
     templates:
-      - charm-unit-jobs-py38
       - charm-unit-jobs-py310
       # More work is needed on the functional jobs; they can't pass at the
       # moment as they need to set up hardware which isn't implemented yet.
       # See LP: #1922214
-      # - charm-xena-functional-jobs
-      # - charm-yoga-functional-jobs
+      # - charm-zed-functional-jobs
     vars:
       needs_charm_build: true
       charm_build_name: manila-netapp
       build_type: charmcraft
+      charmcraft_channel: 2.0/stable
 
diff --git a/test-requirements.txt b/test-requirements.txt
index 3a0ccb0..667006b 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -13,25 +13,10 @@ stestr>=2.2.0
 # https://github.com/mtreinish/stestr/issues/145
 cliff<3.0.0
 
-# Dependencies of stestr. Newer versions use keywords that didn't exist in
-# python 3.5 yet (e.g. "ModuleNotFoundError")
-importlib-metadata<3.0.0; python_version < '3.6'
-importlib-resources<3.0.0; python_version < '3.6'
-
-# Some Zuul nodes sometimes pull newer versions of these dependencies which
-# dropped support for python 3.5:
-osprofiler<2.7.0;python_version<'3.6'
-stevedore<1.31.0;python_version<'3.6'
-debtcollector<1.22.0;python_version<'3.6'
-oslo.utils<=3.41.0;python_version<'3.6'
-
 requests>=2.18.4
 charms.reactive
 
-# Newer mock seems to have some syntax which is newer than python3.5 (e.g.
-# f'{something}'
-mock>=1.2,<4.0.0; python_version < '3.6'
-mock>=1.2; python_version >= '3.6'
+mock>=1.2
 
 nose>=1.3.7
 coverage>=3.6
diff --git a/tests/bundles/jammy-yoga.yaml b/tests/bundles/jammy-yoga.yaml
index 27e1622..b659086 100644
--- a/tests/bundles/jammy-yoga.yaml
+++ b/tests/bundles/jammy-yoga.yaml
@@ -67,7 +67,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '3'
-    channel: yoga/edge
+    channel: latest/edge
 
   glance:
     charm: ch:glance
@@ -76,7 +76,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '4'
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-api:
     charm: ch:neutron-api
@@ -89,11 +89,11 @@ applications:
       neutron-security-groups: true
     to:
       - '5'
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-openvswitch:
     charm: ch:neutron-openvswitch
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-gateway:
     charm: ch:neutron-gateway
@@ -103,7 +103,7 @@ applications:
       bridge-mappings: physnet1:br-ex
     to:
       - '6'
-    channel: yoga/edge
+    channel: latest/edge
 
   keystone:
     charm: ch:keystone
@@ -112,7 +112,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '7'
-    channel: yoga/edge
+    channel: latest/edge
 
   rabbitmq-server:
     charm: ch:rabbitmq-server
@@ -130,7 +130,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '9'
-    channel: yoga/edge
+    channel: latest/edge
 
   nova-compute:
     charm: ch:nova-compute
@@ -143,7 +143,7 @@ applications:
     to:
       - '10'
       - '11'
-    channel: yoga/edge
+    channel: latest/edge
 
   manila:
     charm: ch:manila
@@ -153,7 +153,7 @@ applications:
       default-share-backend: netapp-ontap
     to:
       - '12'
-    channel: yoga/edge
+    channel: latest/edge
 
   manila-netapp:
     charm: ../../manila-netapp.charm
diff --git a/tests/bundles/focal-yoga.yaml b/tests/bundles/jammy-zed.yaml
similarity index 94%
rename from tests/bundles/focal-yoga.yaml
rename to tests/bundles/jammy-zed.yaml
index 0112f92..5f35aba 100644
--- a/tests/bundles/focal-yoga.yaml
+++ b/tests/bundles/jammy-zed.yaml
@@ -1,9 +1,9 @@
 variables:
-  openstack-origin: &openstack-origin cloud:focal-yoga
+  openstack-origin: &openstack-origin cloud:jammy-zed
 
 local_overlay_enabled: True
 
-series: focal
+series: jammy
 
 comment:
 - 'machines section to decide order of deployment. database sooner = faster'
@@ -67,7 +67,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '3'
-    channel: yoga/edge
+    channel: latest/edge
 
   glance:
     charm: ch:glance
@@ -76,7 +76,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '4'
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-api:
     charm: ch:neutron-api
@@ -89,11 +89,11 @@ applications:
       neutron-security-groups: true
     to:
       - '5'
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-openvswitch:
     charm: ch:neutron-openvswitch
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-gateway:
     charm: ch:neutron-gateway
@@ -103,7 +103,7 @@ applications:
       bridge-mappings: physnet1:br-ex
     to:
       - '6'
-    channel: yoga/edge
+    channel: latest/edge
 
   keystone:
     charm: ch:keystone
@@ -112,7 +112,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '7'
-    channel: yoga/edge
+    channel: latest/edge
 
   rabbitmq-server:
     charm: ch:rabbitmq-server
@@ -130,7 +130,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '9'
-    channel: yoga/edge
+    channel: latest/edge
 
   nova-compute:
     charm: ch:nova-compute
@@ -143,7 +143,7 @@ applications:
     to:
       - '10'
       - '11'
-    channel: yoga/edge
+    channel: latest/edge
 
   manila:
     charm: ch:manila
@@ -153,7 +153,7 @@ applications:
       default-share-backend: netapp-ontap
     to:
       - '12'
-    channel: yoga/edge
+    channel: latest/edge
 
   manila-netapp:
     charm: ../../manila-netapp.charm
diff --git a/tests/bundles/focal-xena.yaml b/tests/bundles/kinetic-zed.yaml
similarity index 95%
rename from tests/bundles/focal-xena.yaml
rename to tests/bundles/kinetic-zed.yaml
index ffe3d40..64ea5b7 100644
--- a/tests/bundles/focal-xena.yaml
+++ b/tests/bundles/kinetic-zed.yaml
@@ -1,9 +1,9 @@
 variables:
-  openstack-origin: &openstack-origin cloud:focal-xena
+  openstack-origin: &openstack-origin distro
 
 local_overlay_enabled: True
 
-series: focal
+series: kinetic
 
 comment:
 - 'machines section to decide order of deployment. database sooner = faster'
@@ -67,7 +67,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '3'
-    channel: yoga/edge
+    channel: latest/edge
 
   glance:
     charm: ch:glance
@@ -76,7 +76,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '4'
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-api:
     charm: ch:neutron-api
@@ -89,11 +89,11 @@ applications:
       neutron-security-groups: true
     to:
       - '5'
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-openvswitch:
     charm: ch:neutron-openvswitch
-    channel: yoga/edge
+    channel: latest/edge
 
   neutron-gateway:
     charm: ch:neutron-gateway
@@ -103,7 +103,7 @@ applications:
       bridge-mappings: physnet1:br-ex
     to:
       - '6'
-    channel: yoga/edge
+    channel: latest/edge
 
   keystone:
     charm: ch:keystone
@@ -112,7 +112,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '7'
-    channel: yoga/edge
+    channel: latest/edge
 
   rabbitmq-server:
     charm: ch:rabbitmq-server
@@ -130,7 +130,7 @@ applications:
       openstack-origin: *openstack-origin
     to:
       - '9'
-    channel: yoga/edge
+    channel: latest/edge
 
   nova-compute:
     charm: ch:nova-compute
@@ -143,7 +143,7 @@ applications:
     to:
       - '10'
       - '11'
-    channel: yoga/edge
+    channel: latest/edge
 
   manila:
     charm: ch:manila
@@ -153,7 +153,7 @@ applications:
       default-share-backend: netapp-ontap
     to:
       - '12'
-    channel: yoga/edge
+    channel: latest/edge
 
   manila-netapp:
     charm: ../../manila-netapp.charm
diff --git a/tests/tests.yaml b/tests/tests.yaml
index 4125ce6..8d6c411 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -1,16 +1,17 @@
 charm_name: manila-netapp
 
 gate_bundles:
-  - focal-xena
+  - jammy-yoga
 
 dev_bundles:
-  - focal-yoga
   - jammy-yoga
+  - jammy-zed
+  - kinetic-zed
 
 # WARNING(lourot): func-smoke has been temporarily disabled in tox.ini. See
 # rationale there.
 smoke_bundles:
-- focal-xena
+  - jammy-yoga
 
 target_deploy_status: {}
 
@@ -30,5 +31,5 @@ tests:
 
 tests_options:
   force_deploy:
-    - jammy-yoga
+    - kinetic-zed
 
diff --git a/tox.ini b/tox.ini
index 173345e..e8ce0b8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -112,7 +112,7 @@ basepython = python3
 deps = -r{toxinidir}/build-requirements.txt
 commands =
     charmcraft clean
-    charmcraft -v build
+    charmcraft -v pack
     {toxinidir}/rename.sh
 
 [testenv:func-noop]