From ab7da48117aa2c18c0b204e62438bc4a2118f770 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mar 27 2018 05:37:20 +0000 Subject: Strip question-mark from the container name if present. --- diff --git a/freshmaker/lightblue.py b/freshmaker/lightblue.py index 5423c1f..fd2dc83 100644 --- a/freshmaker/lightblue.py +++ b/freshmaker/lightblue.py @@ -194,7 +194,12 @@ class ContainerImage(dict): m = re.match(r".*/(?P.*)/(?P.*)#(?P.*)", source) if m: namespace = m.group("namespace") - container = m.group("container") + # For some Koji tasks, the container part ends with "?" in + # source URL. This is just because some custom scripts for + # submitting those builds include this character in source URL + # to mark the query part of URL. We need to handle that by + # stripping that character. + container = m.group("container").rstrip("?") data["repository"] = namespace + "/" + container data["commit"] = m.group("commit") diff --git a/tests/test_lightblue.py b/tests/test_lightblue.py index c45bc9b..866fe88 100644 --- a/tests/test_lightblue.py +++ b/tests/test_lightblue.py @@ -173,7 +173,7 @@ class TestContainerImageObject(helpers.FreshmakerTestCase): get_build.return_value = {"task_id": 123456} get_task_request.return_value = [ - "git://example.com/rpms/repo-1#commit_hash1", "target1", {}] + "git://example.com/rpms/repo-1?#commit_hash1", "target1", {}] image.resolve_commit("openssl") self.assertEqual(image["repository"], "rpms/repo-1")