From bb172c5c03bf6dd4f5ba8c6209d4de85fe9bda8a Mon Sep 17 00:00:00 2001
From: Alex Kavanagh <alex.kavanagh@canonical.com>
Date: Fri, 25 Mar 2022 17:00:07 +0000
Subject: [PATCH] Updates to enable jammy and finalise charmcraft builds

- Add 22.04 to charmcraft.yaml
- Update metadata to include jammy
- Remove impish from metadata
- Update osci.yaml to include py3.10 default job
- Modify tox.ini to remove py35,py36,py37 tox target and add py310
  target.
- ensure that the openstack-origin is yoga
- Pin setuptools < 50.0 in src/wheelhouse.txt

Change-Id: I29b80b1e4797eb794c0e2611e732c376d99c270f
---
 .gitignore         |  1 +
 .zuul.yaml         |  2 +-
 charmcraft.yaml    | 16 ++++++++++++----
 osci.yaml          |  2 +-
 requirements.txt   |  9 ++++++++-
 src/metadata.yaml  |  2 +-
 src/wheelhouse.txt |  2 ++
 tox.ini            | 15 +++++----------
 8 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7e4eb0d..59af4a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ interfaces
 __pycache__
 .testrepository
 .stestr
+*.charm
diff --git a/.zuul.yaml b/.zuul.yaml
index 0eed196..7ffc71c 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,4 +1,4 @@
 - project:
     templates:
-      - openstack-python3-ussuri-jobs
+      - openstack-python3-charm-yoga-jobs
       - openstack-cover-jobs
diff --git a/charmcraft.yaml b/charmcraft.yaml
index 4968216..c9a0ed7 100644
--- a/charmcraft.yaml
+++ b/charmcraft.yaml
@@ -19,7 +19,15 @@ parts:
       cp -r $CHARMCRAFT_STAGE/* .
 
 bases:
-  - name: ubuntu
-    channel: "20.04"
-    architectures:
-      - amd64
+  - build-on:
+      - name: ubuntu
+        channel: "20.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]
diff --git a/osci.yaml b/osci.yaml
index a48b7ce..1c2357a 100644
--- a/osci.yaml
+++ b/osci.yaml
@@ -1,7 +1,7 @@
 - project:
     templates:
       - charm-unit-jobs-py38
-      - charm-unit-jobs-py39
+      - charm-unit-jobs-py310
       - charm-xena-functional-jobs
       - charm-yoga-functional-jobs
     vars:
diff --git a/requirements.txt b/requirements.txt
index a68620f..7755b95 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,9 +8,16 @@
 # requirements.txt
 setuptools<50.0.0  # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
 
+# NOTE: newer versions of cryptography require a Rust compiler to build,
+# see
+# * https://github.com/openstack-charmers/zaza/issues/421
+# * https://mail.python.org/pipermail/cryptography-dev/2021-January/001003.html
+#
+cryptography<3.4
+
 # Build requirements
 cffi==1.14.6; python_version < '3.6'  # cffi 1.15.0 drops support for py35.
-charm-tools==2.8.3
+git+https://github.com/juju/charm-tools#egg=charm-tools
 
 simplejson
 
diff --git a/src/metadata.yaml b/src/metadata.yaml
index cf6e944..c1951ee 100644
--- a/src/metadata.yaml
+++ b/src/metadata.yaml
@@ -13,7 +13,7 @@ tags:
 - dns
 series:
 - focal
-- impish
+- jammy
 subordinate: false
 extra-bindings:
   dns-frontend:
diff --git a/src/wheelhouse.txt b/src/wheelhouse.txt
index b060b4d..49aa2ad 100644
--- a/src/wheelhouse.txt
+++ b/src/wheelhouse.txt
@@ -1,6 +1,8 @@
 # pin Jinja2 to the last versions supporting python 3.4 for trusty
 Jinja2<=2.10.1
+MarkupSafe<=2.0.1
 psutil
+setuptools < 50.0
 
 git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack
 
diff --git a/tox.ini b/tox.ini
index 2d60b8a..e22fe48 100644
--- a/tox.ini
+++ b/tox.ini
@@ -68,21 +68,11 @@ basepython = python3
 deps = -r{toxinidir}/test-requirements.txt
 commands = stestr run --slowest {posargs}
 
-[testenv:py35]
-basepython = python3.5
-deps = -r{toxinidir}/test-requirements.txt
-commands = stestr run --slowest {posargs}
-
 [testenv:py36]
 basepython = python3.6
 deps = -r{toxinidir}/test-requirements.txt
 commands = stestr run --slowest {posargs}
 
-[testenv:py37]
-basepython = python3.7
-deps = -r{toxinidir}/test-requirements.txt
-commands = stestr run --slowest {posargs}
-
 [testenv:py38]
 basepython = python3.8
 deps = -r{toxinidir}/test-requirements.txt
@@ -93,6 +83,11 @@ basepython = python3.9
 deps = -r{toxinidir}/test-requirements.txt
 commands = stestr run --slowest {posargs}
 
+[testenv:py310]
+basepython = python3.10
+deps = -r{toxinidir}/test-requirements.txt
+commands = stestr run --slowest {posargs}
+
 [testenv:pep8]
 basepython = python3
 deps = flake8==3.9.2