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
This commit is contained in:
Michael Kelly 2024-11-07 09:26:15 -08:00
parent 3cff35ce48
commit c1febff1ea
No known key found for this signature in database
GPG Key ID: 77F7FE93040ECF3E
4 changed files with 7 additions and 23 deletions

View File

@ -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

View File

@ -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"

View File

@ -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(

View File

@ -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']