From 44facbfe723d006fdc81a634aa274d6b3f89b37e Mon Sep 17 00:00:00 2001 From: roytev Date: Thu, 28 Mar 2024 13:47:31 +0200 Subject: [PATCH 1/3] Update docker.py --- artifactory_cleanup/rules/docker.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/artifactory_cleanup/rules/docker.py b/artifactory_cleanup/rules/docker.py index 40c54c0..2e24407 100644 --- a/artifactory_cleanup/rules/docker.py +++ b/artifactory_cleanup/rules/docker.py @@ -45,9 +45,8 @@ def _manifest_to_docker_images(self, artifacts: ArtifactsList): # already done it or it's just a folder if "name" not in artifact or artifact["name"] != self.MANIFEST_FILENAME: continue - - artifact["path"], docker_tag = artifact["path"].rsplit("/", 1) - artifact["name"] = docker_tag + artifact["path"] = artifact["properties"]["docker.repoName"] + artifact["name"] = artifact["properties"]["docker.manifest"] # We're going to collect docker size later if "size" in artifact: del artifact["size"] From db046eb2d7f9c49ddfdf089b90c463d110238352 Mon Sep 17 00:00:00 2001 From: roytev Date: Thu, 28 Mar 2024 13:54:05 +0200 Subject: [PATCH 2/3] Update test_rules_docker.py --- tests/test_rules_docker.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_rules_docker.py b/tests/test_rules_docker.py index 0bf1666..7209adb 100644 --- a/tests/test_rules_docker.py +++ b/tests/test_rules_docker.py @@ -14,67 +14,67 @@ def test_filter(self): data = [ { - "properties": {"docker.manifest": "0.1.100"}, + "properties": {"docker.manifest": "0.1.100", "docker.repoName": "foobar"}, "path": "foobar/0.1.100", "name": "manifest.json", }, { - "properties": {"docker.manifest": "0.1.200"}, + "properties": {"docker.manifest": "0.1.200", "docker.repoName": "foobar"}, "path": "foobar/0.1.200", "name": "manifest.json", }, { - "properties": {"docker.manifest": "0.1.99"}, + "properties": {"docker.manifest": "0.1.99", "docker.repoName": "foobar"}, "path": "foobar/0.1.99", "name": "manifest.json", }, { - "properties": {"docker.manifest": "1.1.1"}, + "properties": {"docker.manifest": "1.1.1", "docker.repoName": "foobar"}, "path": "foobar/1.1.1", "name": "manifest.json", }, { - "properties": {"docker.manifest": "1.2.1"}, + "properties": {"docker.manifest": "1.2.1", "docker.repoName": "foobar"}, "path": "foobar/1.2.1", "name": "manifest.json", }, { - "properties": {"docker.manifest": "1.3.1"}, + "properties": {"docker.manifest": "1.3.1", "docker.repoName": "foobar"}, "path": "foobar/1.3.1", "name": "manifest.json", }, { - "properties": {"docker.manifest": "2.1.1"}, + "properties": {"docker.manifest": "2.1.1", "docker.repoName": "foobar"}, "path": "foobar/2.1.1", "name": "manifest.json", }, { - "properties": {"docker.manifest": "0.1.86"}, + "properties": {"docker.manifest": "0.1.86", "docker.repoName": "baz"}, "path": "baz/0.1.86", "name": "manifest.json", }, { - "properties": {"docker.manifest": "0.1.87"}, + "properties": {"docker.manifest": "0.1.87", "docker.repoName": "baz"}, "path": "baz/0.1.87", "name": "manifest.json", }, { - "properties": {"docker.manifest": "0.1.83"}, + "properties": {"docker.manifest": "0.1.83", "docker.repoName": "baz"}, "path": "baz/0.1.83", "name": "manifest.json", }, { - "properties": {"docker.manifest": "v0.1.100"}, + "properties": {"docker.manifest": "v0.1.100", "docker.repoName": "qux"}, "path": "qux/v0.1.100", "name": "manifest.json", }, { - "properties": {"docker.manifest": "v0.1.200"}, + "properties": {"docker.manifest": "v0.1.200", "docker.repoName": "qux"}, "path": "qux/v0.1.200", "name": "manifest.json", }, { - "properties": {"docker.manifest": "v0.1.99"}, + "properties": {"docker.manifest": "v0.1.99", "docker.repoName": "qux"}, "path": "qux/v0.1.99", "name": "manifest.json", }, From 4c98a0e1cb08243de9a1dec22339a92b77b57517 Mon Sep 17 00:00:00 2001 From: roytev Date: Thu, 28 Mar 2024 13:54:56 +0200 Subject: [PATCH 3/3] Update test_rules_docker.py --- tests/test_rules_docker.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_rules_docker.py b/tests/test_rules_docker.py index 7209adb..63de7f8 100644 --- a/tests/test_rules_docker.py +++ b/tests/test_rules_docker.py @@ -94,25 +94,25 @@ def test_filter(self): { "name": "0.1.83", "path": "baz", - "properties": {"docker.manifest": "0.1.83"}, + "properties": {"docker.manifest": "0.1.83", "docker.repoName": "baz"}, "stats": {}, }, { "name": "0.1.99", "path": "foobar", - "properties": {"docker.manifest": "0.1.99"}, + "properties": {"docker.manifest": "0.1.99", "docker.repoName": "foobar"}, "stats": {}, }, { "name": "1.1.1", "path": "foobar", - "properties": {"docker.manifest": "1.1.1"}, + "properties": {"docker.manifest": "1.1.1", "docker.repoName": "foobar"}, "stats": {}, }, { "name" : "v0.1.99", "path": "qux", - "properties": {"docker.manifest": "v0.1.99"}, + "properties": {"docker.manifest": "v0.1.99", "docker.repoName": "qux"}, "stats": {}, }, ]