From f89376531936f740ce91fb1802581772475a6541 Mon Sep 17 00:00:00 2001 From: Jan Segre Date: Wed, 11 Dec 2024 17:19:20 +0100 Subject: [PATCH] chore(docker): include python suffix tags on rc images --- extras/github/docker.py | 9 +++------ extras/github/test_docker.py | 15 ++++++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/extras/github/docker.py b/extras/github/docker.py index 3a0c667e9..b7ee9bbf4 100644 --- a/extras/github/docker.py +++ b/extras/github/docker.py @@ -97,12 +97,9 @@ def extract_pyver(filename): tags = set() - # We don't want a tag with a python suffix for release-candidates - if is_release_candidate: - version = base_version - else: - version = base_version + '-' + suffix - tags.add(version) + # Always include -python{Version} suffix variant + version = base_version + '-' + suffix + tags.add(version) if suffix == default_python: tags.add(base_version) diff --git a/extras/github/test_docker.py b/extras/github/test_docker.py index a38060acc..b5db27e67 100644 --- a/extras/github/test_docker.py +++ b/extras/github/test_docker.py @@ -97,13 +97,14 @@ def test_release_candidate_non_default_python(self): self.assertEqual(base_version, 'v0.53.0-rc.1') output = prep_tags(os.environ, base_version, is_release_candidate) + version_with_python = f'{base_version}-python{NON_DEFAULT_PYTHON_VERSION}' self.assertNotIn('slack-notification-version', output) - self.assertEqual(output['version'], base_version) + self.assertEqual(output['version'], version_with_python) self.assertEqual(output['login-dockerhub'], 'true') self.assertEqual(output['login-ghcr'], 'false') - self.assertEqual(output['tags'], 'dont-push--local-only') - self.assertEqual(output['push'], 'false') + self.assertEqual(output['tags'], f'mock_image:{version_with_python}') + self.assertEqual(output['push'], 'true') self.assertEqual(output['dockerfile'], 'Dockerfile') def test_release_candidate_default_python(self): @@ -127,12 +128,16 @@ def test_release_candidate_default_python(self): self.assertEqual(base_version, 'v0.53.0-rc.1') output = prep_tags(os.environ, base_version, is_release_candidate) + version_with_python = f'{base_version}-python{DEFAULT_PYTHON_VERSION}' self.assertEqual(output['slack-notification-version'], base_version) - self.assertEqual(output['version'], base_version) + self.assertEqual(output['version'], version_with_python) self.assertEqual(output['login-dockerhub'], 'true') self.assertEqual(output['login-ghcr'], 'false') - self.assertEqual(output['tags'], 'mock_image:v0.53.0-rc.1') + self.assertEqual( + set(output['tags'].split(',')), + {f'mock_image:{version_with_python}', 'mock_image:v0.53.0-rc.1'}, + ) self.assertEqual(output['push'], 'true') self.assertEqual(output['dockerfile'], 'Dockerfile')