From c1febff1ea0fd31b4dd3d59eb3a9003a3d0fb48b Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Thu, 7 Nov 2024 09:26:15 -0800 Subject: [PATCH] Fix CI failures This change fixes a few CI failures in the zuul-operator * nox docs: the regex expression wasn't accepted * version.py was broken because pkg_resources is removed from newer pythons * the /api/tenants endpoint no longer appears to return projects or queue items so the functional test was failing Change-Id: Ia492fa48ff682454553d9c1b04d4e83b40a276cf --- doc/source/conf.py | 2 +- playbooks/zuul-operator-functional/test.yaml | 13 ------------- zuul_operator/cmd.py | 4 ++-- zuul_operator/version.py | 11 ++++------- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index a5bc6ce..326a032 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -85,7 +85,7 @@ except subprocess.CalledProcessError: interesting_tags = [] for tag in output.splitlines(): - if re.match('^\d+\.\d+\.\d+$', tag): + if re.match(r'^\d+\.\d+\.\d+$', tag): parts = tuple(map(int, tag.split('.'))) if parts < min_version: continue diff --git a/playbooks/zuul-operator-functional/test.yaml b/playbooks/zuul-operator-functional/test.yaml index 499cb15..d21de87 100644 --- a/playbooks/zuul-operator-functional/test.yaml +++ b/playbooks/zuul-operator-functional/test.yaml @@ -44,8 +44,6 @@ endpoint: "/api/tenants" expected: - name: local - projects: 1 - queue: 0 - name: setup git service include_tasks: tasks/git_setup.yaml @@ -124,17 +122,6 @@ path: /run/dbus type: DirectoryOrCreate - - name: ensure a job is running - when: skip_check is not defined - include_tasks: tasks/zuul_web_check.yaml - vars: - endpoint: "/api/tenants" - expected: - - name: local - projects: 1 - # 1 queue means a job is running - queue: 1 - - name: get build results uri: url: "{{ zuul_web_url }}/api/tenant/local/builds?complete=true" diff --git a/zuul_operator/cmd.py b/zuul_operator/cmd.py index 115a787..3fe91ee 100644 --- a/zuul_operator/cmd.py +++ b/zuul_operator/cmd.py @@ -24,8 +24,8 @@ class ZuulOperatorCommand: self.op = ZuulOperator() def _get_version(self): - from zuul_operator.version import version_info as version_info - return "Zuul Operator version: %s" % version_info.release_string() + from zuul_operator.version import release_string + return "Zuul Operator version: %s" % release_string def run(self): parser = argparse.ArgumentParser( diff --git a/zuul_operator/version.py b/zuul_operator/version.py index bcc8c9e..4f7d602 100644 --- a/zuul_operator/version.py +++ b/zuul_operator/version.py @@ -15,18 +15,15 @@ import json -import pbr.version -import pkg_resources +from importlib import metadata as importlib_metadata -version_info = pbr.version.VersionInfo('zuul-operator') -release_string = version_info.release_string() +zuul_operator_distribution = importlib_metadata.distribution('zuul-operator') +release_string = zuul_operator_distribution.version is_release = None git_version = None try: - _metadata = json.loads( - pkg_resources.get_distribution( - 'zuul-operator').get_metadata('pbr.json')) + _metadata = json.loads(zuul_operator_distribution.read_text('pbr.json')) if _metadata: is_release = _metadata['is_release'] git_version = _metadata['git_version']