From: Bengt Thuree Date: Thu, 10 Nov 2022 05:31:57 +0000 (+1100) Subject: Fix: Replace v1 dockerhub api with v2 json files X-Git-Tag: v0.37.2^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F70986%2F6;p=releng%2Flftools.git Fix: Replace v1 dockerhub api with v2 json files Signed-off-by: Bengt Thuree Change-Id: Iac2e23671bb421745099a1b4cbc56187ab39474f --- diff --git a/lftools/nexus/release_docker_hub.py b/lftools/nexus/release_docker_hub.py index 81fd7833..449eff88 100644 --- a/lftools/nexus/release_docker_hub.py +++ b/lftools/nexus/release_docker_hub.py @@ -40,6 +40,7 @@ lftools nexus docker releasedockerhub """ from __future__ import print_function +import json import logging import multiprocessing import os @@ -269,14 +270,18 @@ class DockerTagClass(TagClass): This class fetches and stores all docker tags for a repository. Doing this manually from command line, you will give this command: - curl -s https://registry.hub.docker.com/v1/repositories/onap/base_sdc-sanity/tags - which gives you the following output: - {"layer": "", "name": "latest"}, {"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, {"layer": "", "name": "1.4.0"}, - {"layer": "", "name": "1.4.1"}, {"layer": "", "name": "v1.0.0"}] + curl -s https://registry.hub.docker.com:443/v2/namespaces/onap/repositories/base_sdc-sanity/tags + which gives you a json output. Just looking for the tag names we do this + curl -s https://registry.hub.docker.com:443/v2/namespaces/onap/repositories/base_sdc-sanity/tags | jq -r ".results[].name" + latest + 1.7.0 + 1.6.0 + 1.4.1 + 1.4.0 + 1.3.1 + 1.3.0 + v1.0.0 - When we fetch the tags from the docker repository url, they are returned like - [{"layer": "", "name": "latest"}, {"layer": "", "name": "v1.0.0"}] Hence, we need to extract all the tags, and add them to our list of valid or invalid tags. If we fail to collect the tags, we set the repository_exist flag to false. @@ -292,7 +297,7 @@ class DockerTagClass(TagClass): If no repository is found, self.repository_exist will be set to False. """ - _docker_base = "https://registry.hub.docker.com/v1/repositories" + _docker_base_start = "https://registry.hub.docker.com/v2/namespaces/" def __init__(self, org_name, repo_name, repo_from_file): """Initialize this class.""" @@ -302,49 +307,55 @@ class DockerTagClass(TagClass): else: combined_repo_name = "{}/{}".format(org_name, repo_name) log.debug("Fetching docker tags for {}".format(combined_repo_name)) - retries = 0 - while retries < 20: - try: - r = _request_get(self._docker_base + "/" + combined_repo_name + "/tags") - if r.status_code == 429: - # Docker returns 429 if we access it too fast too many times. - # If it happends, delay 60 seconds, and try again, up to 19 times. - log.debug( - "Too many docker gets too fast, wait 1 min: {}, repo {}".format(retries, combined_repo_name) - ) - time.sleep(60) + _docker_base = self._docker_base_start + "{}/repositories".format(org_name) + still_more = True + docker_tag_url = _docker_base + "/" + repo_name + "/tags" + while still_more: + retries = 0 + while retries < 20: + try: + log.debug("URL={}".format(docker_tag_url)) + r = _request_get(docker_tag_url) + if r.status_code == 429: + # Docker returns 429 if we access it too fast too many times. + # If it happends, delay 60 seconds, and try again, up to 19 times. + log.debug( + "Too many docker gets too fast, wait 1 min: {}, repo {}".format(retries, combined_repo_name) + ) + time.sleep(60) + retries = retries + 1 + else: + break + except requests.HTTPError as excinfo: + log.debug("Fetching Docker Hub tags. {}".format(excinfo)) retries = retries + 1 - else: - break - except requests.HTTPError as excinfo: - log.debug("Fetching Docker Hub tags. {}".format(excinfo)) - retries = retries + 1 - if retries > 19: - self.repository_exist = False - return - - log.debug("r.status_code = {}, ok={}".format(r.status_code, r.status_code == requests.codes.ok)) - if r.status_code == 429: - # Speed throttling in effect. Cancel program - raise requests.HTTPError( - "Speed throttling in effect. To fast accessing dockerhub for tags.\n {}".format(r.text) - ) - if r.status_code == requests.codes.ok: - raw_tags = r.text - raw_tags = raw_tags.replace("}]", "") - raw_tags = raw_tags.replace("[{", "") - raw_tags = raw_tags.replace("{", "") - raw_tags = raw_tags.replace('"', "") - raw_tags = raw_tags.replace(" ", "") - TmpSplittedTuple = raw_tags.split("}") - if len(TmpSplittedTuple) > 0: - for tuple in TmpSplittedTuple: - tmp_tuple = tuple.split(":") - if len(tmp_tuple) > 1: - self.add_tag(tmp_tuple[2].strip()) - log.debug("Docker {} has tag {}".format(combined_repo_name, tmp_tuple[2])) - else: - self.repository_exist = False + if retries > 19: + self.repository_exist = False + return + + log.debug("r.status_code = {}, ok={}".format(r.status_code, r.status_code == requests.codes.ok)) + if r.status_code == 429: + # Speed throttling in effect. Cancel program + raise requests.HTTPError( + "Dockerhub throttling at tag fetching.\n {}".format(r.text) + ) + if r.status_code == requests.codes.ok: + raw_json = json.loads(r.text) + + try: + for result in raw_json["results"]: + tag_name = result["name"] + self.add_tag(tag_name) + log.debug("Docker {} has tag {}".format(combined_repo_name, tag_name)) + except: + log.debug("Issue fetching tags for {}".format(combined_repo_name)) + else: + self.repository_exist = False + if raw_json["next"]: + docker_tag_url = raw_json["next"] + still_more = True + else: + still_more = False class ProjectClass: diff --git a/releasenotes/notes/Move-to-v2-on-dockerhub-tag-api-62834fe85a7808f8.yaml b/releasenotes/notes/Move-to-v2-on-dockerhub-tag-api-62834fe85a7808f8.yaml new file mode 100644 index 00000000..d85b0ad2 --- /dev/null +++ b/releasenotes/notes/Move-to-v2-on-dockerhub-tag-api-62834fe85a7808f8.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Dockerhub retired the v1 version of the dockerhub api, which was used + to collect the existing tag information. This patch replaces v1 with v2 + which is using json files. diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-gizmo.json b/tests/fixtures/nexus/releasedockerhub_dockertags-gizmo.json new file mode 100644 index 00000000..52a48437 --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-gizmo.json @@ -0,0 +1,224 @@ +{ + "count": 7, + "next": null, + "previous": null, + "results": [ + { + "creator": 4339606, + "id": 68582206, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:b5394b4697cfeaae2494a5c8ac9254c9415213f4a1241b5d63137110f54ab8d0", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 236420979, + "status": "active", + "last_pulled": "2022-08-14T13:55:25.099592Z", + "last_pushed": "2022-11-16T12:02:42.108521Z" + } + ], + "last_updated": "2022-11-16T12:02:42.108521Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.5.2", + "repository": 6189598, + "full_size": 236420979, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-14T13:55:25.099592Z", + "tag_last_pushed": "2022-11-16T12:02:42.108521Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:b5394b4697cfeaae2494a5c8ac9254c9415213f4a1241b5d63137110f54ab8d0" + }, + { + "creator": 4339606, + "id": 54419291, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:04bcb7034020c3740d57abff5bc205270c27f0023a093f2fd5d902487a3e01d2", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 330956612, + "status": "active", + "last_pulled": "2022-01-18T13:34:50.997188Z", + "last_pushed": "2022-11-16T12:02:22.142022Z" + } + ], + "last_updated": "2022-11-16T12:02:22.142022Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.4.0", + "repository": 6189598, + "full_size": 330956612, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T13:34:50.997188Z", + "tag_last_pushed": "2022-11-16T12:02:22.142022Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:04bcb7034020c3740d57abff5bc205270c27f0023a093f2fd5d902487a3e01d2" + }, + { + "creator": 4339606, + "id": 44037046, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:5579c0f5f46f75fd23effc319a8d8169253c720fc3aa83fcb5ef2cc44a9f79a7", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 306777861, + "status": "active", + "last_pulled": "2022-01-18T13:34:47.196389Z", + "last_pushed": "2022-11-16T12:01:51.181469Z" + } + ], + "last_updated": "2022-11-16T12:01:51.181469Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.2", + "repository": 6189598, + "full_size": 306777861, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T13:34:47.196389Z", + "tag_last_pushed": "2022-11-16T12:01:51.181469Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:5579c0f5f46f75fd23effc319a8d8169253c720fc3aa83fcb5ef2cc44a9f79a7" + }, + { + "creator": 4339606, + "id": 39041406, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:39c30a61fe8705536dd193bbfbd96820901700a7380c5d75f081d1f8312aa0e3", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 309691887, + "status": "active", + "last_pulled": "2022-08-14T13:55:40.256178Z", + "last_pushed": "2022-11-16T12:01:22.802907Z" + } + ], + "last_updated": "2022-11-16T12:01:22.802907Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.1", + "repository": 6189598, + "full_size": 309691887, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-14T13:55:40.256178Z", + "tag_last_pushed": "2022-11-16T12:01:22.802907Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:39c30a61fe8705536dd193bbfbd96820901700a7380c5d75f081d1f8312aa0e3" + }, + { + "creator": 4339606, + "id": 38206299, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:3945e98997fb875b6d5f8db21967f1b3c05023ff5b5986f14b99a3ada7c6bf90", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 334469313, + "status": "active", + "last_pulled": "2022-08-14T13:55:44.929781Z", + "last_pushed": "2022-11-16T12:00:57.436924Z" + } + ], + "last_updated": "2022-11-16T12:00:57.436924Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.0", + "repository": 6189598, + "full_size": 334469313, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-14T13:55:44.929781Z", + "tag_last_pushed": "2022-11-16T12:00:57.436924Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:3945e98997fb875b6d5f8db21967f1b3c05023ff5b5986f14b99a3ada7c6bf90" + }, + { + "creator": 4339606, + "id": 38205809, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:af7298b66c480407d7a8bc650b3122b3c0180038f59c57eaa6903786823ded4b", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 335766308, + "status": "active", + "last_pulled": "2022-01-18T13:34:41.188991Z", + "last_pushed": "2022-11-16T12:00:32.417426Z" + } + ], + "last_updated": "2022-11-16T12:00:32.417426Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.2.1", + "repository": 6189598, + "full_size": 335766308, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T13:34:41.188991Z", + "tag_last_pushed": "2022-11-16T12:00:32.417426Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:af7298b66c480407d7a8bc650b3122b3c0180038f59c57eaa6903786823ded4b" + }, + { + "creator": 4339606, + "id": 38205256, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:a09ec6b5443e94aeab2b61491e56af124a2d50c9eab3e555f7c6fdd22309598b", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 335764567, + "status": "active", + "last_pulled": "2022-01-18T13:34:40.069568Z", + "last_pushed": "2022-11-16T11:59:51.061067Z" + } + ], + "last_updated": "2022-11-16T11:59:51.061067Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.2.0", + "repository": 6189598, + "full_size": 335764567, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T13:34:40.069568Z", + "tag_last_pushed": "2022-11-16T11:59:51.061067Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:a09ec6b5443e94aeab2b61491e56af124a2d50c9eab3e555f7c6fdd22309598b" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-gizmo2.json b/tests/fixtures/nexus/releasedockerhub_dockertags-gizmo2.json new file mode 100644 index 00000000..892f1909 --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-gizmo2.json @@ -0,0 +1,38 @@ +{ + "count": 1, + "next": null, + "previous": null, + "results": [ + { + "creator": 4339606, + "id": 38205809, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:af7298b66c480407d7a8bc650b3122b3c0180038f59c57eaa6903786823ded4b", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 335766308, + "status": "active", + "last_pulled": "2022-01-18T13:34:41.188991Z", + "last_pushed": "2022-11-16T12:00:32.417426Z" + } + ], + "last_updated": "2022-11-16T12:00:32.417426Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.2.1", + "repository": 6189598, + "full_size": 335766308, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T13:34:41.188991Z", + "tag_last_pushed": "2022-11-16T12:00:32.417426Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:af7298b66c480407d7a8bc650b3122b3c0180038f59c57eaa6903786823ded4b" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator-missing1.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator-missing1.json new file mode 100644 index 00000000..ce852da9 --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator-missing1.json @@ -0,0 +1,222 @@ +{ + "count": 7, + "next": null, + "previous": null, + "results": [ + { + "creator": 2325232, + "id": 18139761, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:94817a898d8fb8c8cf026d50e1f6cfba33a1ffcce0b509f839453fc0151f8a8d", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 263397032, + "status": "inactive", + "last_pulled": "2022-08-24T11:48:42.659535Z", + "last_pushed": null + } + ], + "last_updated": "2017-11-17T02:45:19.803615Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "latest", + "repository": 2072215, + "full_size": 263397032, + "v2": true, + "tag_status": "inactive", + "tag_last_pulled": "2022-08-24T11:48:42.659535Z", + "tag_last_pushed": "2017-11-17T02:45:19.803615Z", + "media_type": "application/vnd.docker.container.image.v1+json" + }, + { + "creator": 2325232, + "id": 106292229, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:83be7b22a35c6a5095625162ac5b99e69b1ee7f559afd8e55c4c6f4fb895c396", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 167002156, + "status": "active", + "last_pulled": "2022-08-15T19:03:01.021577Z", + "last_pushed": "2022-11-08T11:06:51.705111Z" + } + ], + "last_updated": "2022-11-08T11:06:51.705111Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.0", + "repository": 2072215, + "full_size": 167002156, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-15T19:03:01.021577Z", + "tag_last_pushed": "2022-11-08T11:06:51.705111Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:83be7b22a35c6a5095625162ac5b99e69b1ee7f559afd8e55c4c6f4fb895c396" + }, + { + "creator": 2325232, + "id": 89473871, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:d81112d512ced317667fe0ba8af97c375eeeee55e3e9c8e3c8b4727711407a29", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 166992528, + "status": "active", + "last_pulled": "2022-08-15T19:03:05.755264Z", + "last_pushed": "2022-11-08T11:06:36.826187Z" + } + ], + "last_updated": "2022-11-08T11:06:36.826187Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.6.0", + "repository": 2072215, + "full_size": 166992528, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-15T19:03:05.755264Z", + "tag_last_pushed": "2022-11-08T11:06:36.826187Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:d81112d512ced317667fe0ba8af97c375eeeee55e3e9c8e3c8b4727711407a29" + }, + { + "creator": 4339606, + "id": 39038541, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:bbebbb005eda716ae71c7d0ed666ca4d5476dba6e4c65e990296c87491e8928f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 160488204, + "status": "active", + "last_pulled": "2022-02-07T03:57:05.385318Z", + "last_pushed": "2022-11-08T11:06:20.429126Z" + } + ], + "last_updated": "2022-11-08T11:06:20.429126Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.4.1", + "repository": 2072215, + "full_size": 160488204, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-07T03:57:05.385318Z", + "tag_last_pushed": "2022-11-08T11:06:20.429126Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:bbebbb005eda716ae71c7d0ed666ca4d5476dba6e4c65e990296c87491e8928f" + }, + { + "creator": 4339606, + "id": 38122048, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:062a5498aeecfc4b811a5622caed09c646e990a90c3949a74b9322a94a82c88c", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 163948477, + "status": "active", + "last_pulled": "2022-01-18T11:27:05.97255Z", + "last_pushed": "2022-11-08T11:05:53.36546Z" + } + ], + "last_updated": "2022-11-08T11:05:53.36546Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.1", + "repository": 2072215, + "full_size": 163948477, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:05.97255Z", + "tag_last_pushed": "2022-11-08T11:05:53.36546Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:062a5498aeecfc4b811a5622caed09c646e990a90c3949a74b9322a94a82c88c" + }, + { + "creator": 4339606, + "id": 38121837, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:35745e346218e2e2eb38107beebc728d63d4f06275d45aa1d764c280ab4fd88e", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 155070350, + "status": "active", + "last_pulled": "2022-01-18T11:27:05.345194Z", + "last_pushed": "2022-11-08T11:05:39.428958Z" + } + ], + "last_updated": "2022-11-08T11:05:39.428958Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.0", + "repository": 2072215, + "full_size": 155070350, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:05.345194Z", + "tag_last_pushed": "2022-11-08T11:05:39.428958Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:35745e346218e2e2eb38107beebc728d63d4f06275d45aa1d764c280ab4fd88e" + }, + { + "creator": 2325232, + "id": 18139766, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:94817a898d8fb8c8cf026d50e1f6cfba33a1ffcce0b509f839453fc0151f8a8d", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 263397032, + "status": "inactive", + "last_pulled": "2022-08-24T11:48:42.659535Z", + "last_pushed": null + } + ], + "last_updated": "2017-11-17T02:45:28.016607Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "v1.0.0", + "repository": 2072215, + "full_size": 263397032, + "v2": true, + "tag_status": "inactive", + "tag_last_pulled": "2022-08-24T11:48:42.659535Z", + "tag_last_pushed": "2017-11-17T02:45:28.016607Z", + "media_type": "application/vnd.docker.container.image.v1+json" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator-missing2.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator-missing2.json new file mode 100644 index 00000000..5df45a95 --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator-missing2.json @@ -0,0 +1,191 @@ +{ + "count": 6, + "next": null, + "previous": null, + "results": [ + { + "creator": 2325232, + "id": 18139761, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:94817a898d8fb8c8cf026d50e1f6cfba33a1ffcce0b509f839453fc0151f8a8d", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 263397032, + "status": "inactive", + "last_pulled": "2022-08-24T11:48:42.659535Z", + "last_pushed": null + } + ], + "last_updated": "2017-11-17T02:45:19.803615Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "latest", + "repository": 2072215, + "full_size": 263397032, + "v2": true, + "tag_status": "inactive", + "tag_last_pulled": "2022-08-24T11:48:42.659535Z", + "tag_last_pushed": "2017-11-17T02:45:19.803615Z", + "media_type": "application/vnd.docker.container.image.v1+json" + }, + { + "creator": 2325232, + "id": 106292229, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:83be7b22a35c6a5095625162ac5b99e69b1ee7f559afd8e55c4c6f4fb895c396", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 167002156, + "status": "active", + "last_pulled": "2022-08-15T19:03:01.021577Z", + "last_pushed": "2022-11-08T11:06:51.705111Z" + } + ], + "last_updated": "2022-11-08T11:06:51.705111Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.0", + "repository": 2072215, + "full_size": 167002156, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-15T19:03:01.021577Z", + "tag_last_pushed": "2022-11-08T11:06:51.705111Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:83be7b22a35c6a5095625162ac5b99e69b1ee7f559afd8e55c4c6f4fb895c396" + }, + { + "creator": 2325232, + "id": 89473871, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:d81112d512ced317667fe0ba8af97c375eeeee55e3e9c8e3c8b4727711407a29", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 166992528, + "status": "active", + "last_pulled": "2022-08-15T19:03:05.755264Z", + "last_pushed": "2022-11-08T11:06:36.826187Z" + } + ], + "last_updated": "2022-11-08T11:06:36.826187Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.6.0", + "repository": 2072215, + "full_size": 166992528, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-15T19:03:05.755264Z", + "tag_last_pushed": "2022-11-08T11:06:36.826187Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:d81112d512ced317667fe0ba8af97c375eeeee55e3e9c8e3c8b4727711407a29" + }, + { + "creator": 4339606, + "id": 38122048, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:062a5498aeecfc4b811a5622caed09c646e990a90c3949a74b9322a94a82c88c", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 163948477, + "status": "active", + "last_pulled": "2022-01-18T11:27:05.97255Z", + "last_pushed": "2022-11-08T11:05:53.36546Z" + } + ], + "last_updated": "2022-11-08T11:05:53.36546Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.1", + "repository": 2072215, + "full_size": 163948477, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:05.97255Z", + "tag_last_pushed": "2022-11-08T11:05:53.36546Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:062a5498aeecfc4b811a5622caed09c646e990a90c3949a74b9322a94a82c88c" + }, + { + "creator": 4339606, + "id": 38121837, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:35745e346218e2e2eb38107beebc728d63d4f06275d45aa1d764c280ab4fd88e", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 155070350, + "status": "active", + "last_pulled": "2022-01-18T11:27:05.345194Z", + "last_pushed": "2022-11-08T11:05:39.428958Z" + } + ], + "last_updated": "2022-11-08T11:05:39.428958Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.0", + "repository": 2072215, + "full_size": 155070350, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:05.345194Z", + "tag_last_pushed": "2022-11-08T11:05:39.428958Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:35745e346218e2e2eb38107beebc728d63d4f06275d45aa1d764c280ab4fd88e" + }, + { + "creator": 2325232, + "id": 18139766, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:94817a898d8fb8c8cf026d50e1f6cfba33a1ffcce0b509f839453fc0151f8a8d", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 263397032, + "status": "inactive", + "last_pulled": "2022-08-24T11:48:42.659535Z", + "last_pushed": null + } + ], + "last_updated": "2017-11-17T02:45:28.016607Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "v1.0.0", + "repository": 2072215, + "full_size": 263397032, + "v2": true, + "tag_status": "inactive", + "tag_last_pulled": "2022-08-24T11:48:42.659535Z", + "tag_last_pushed": "2017-11-17T02:45:28.016607Z", + "media_type": "application/vnd.docker.container.image.v1+json" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator.json new file mode 100644 index 00000000..e7ed8ffa --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdc-helm-validator.json @@ -0,0 +1,253 @@ +{ + "count": 8, + "next": null, + "previous": null, + "results": [ + { + "creator": 2325232, + "id": 18139761, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:94817a898d8fb8c8cf026d50e1f6cfba33a1ffcce0b509f839453fc0151f8a8d", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 263397032, + "status": "inactive", + "last_pulled": "2022-08-24T11:48:42.659535Z", + "last_pushed": null + } + ], + "last_updated": "2017-11-17T02:45:19.803615Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "latest", + "repository": 2072215, + "full_size": 263397032, + "v2": true, + "tag_status": "inactive", + "tag_last_pulled": "2022-08-24T11:48:42.659535Z", + "tag_last_pushed": "2017-11-17T02:45:19.803615Z", + "media_type": "application/vnd.docker.container.image.v1+json" + }, + { + "creator": 2325232, + "id": 106292229, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:83be7b22a35c6a5095625162ac5b99e69b1ee7f559afd8e55c4c6f4fb895c396", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 167002156, + "status": "active", + "last_pulled": "2022-08-15T19:03:01.021577Z", + "last_pushed": "2022-11-08T11:06:51.705111Z" + } + ], + "last_updated": "2022-11-08T11:06:51.705111Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.0", + "repository": 2072215, + "full_size": 167002156, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-15T19:03:01.021577Z", + "tag_last_pushed": "2022-11-08T11:06:51.705111Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:83be7b22a35c6a5095625162ac5b99e69b1ee7f559afd8e55c4c6f4fb895c396" + }, + { + "creator": 2325232, + "id": 89473871, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:d81112d512ced317667fe0ba8af97c375eeeee55e3e9c8e3c8b4727711407a29", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 166992528, + "status": "active", + "last_pulled": "2022-08-15T19:03:05.755264Z", + "last_pushed": "2022-11-08T11:06:36.826187Z" + } + ], + "last_updated": "2022-11-08T11:06:36.826187Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.6.0", + "repository": 2072215, + "full_size": 166992528, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-15T19:03:05.755264Z", + "tag_last_pushed": "2022-11-08T11:06:36.826187Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:d81112d512ced317667fe0ba8af97c375eeeee55e3e9c8e3c8b4727711407a29" + }, + { + "creator": 4339606, + "id": 39038541, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:bbebbb005eda716ae71c7d0ed666ca4d5476dba6e4c65e990296c87491e8928f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 160488204, + "status": "active", + "last_pulled": "2022-02-07T03:57:05.385318Z", + "last_pushed": "2022-11-08T11:06:20.429126Z" + } + ], + "last_updated": "2022-11-08T11:06:20.429126Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.4.1", + "repository": 2072215, + "full_size": 160488204, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-07T03:57:05.385318Z", + "tag_last_pushed": "2022-11-08T11:06:20.429126Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:bbebbb005eda716ae71c7d0ed666ca4d5476dba6e4c65e990296c87491e8928f" + }, + { + "creator": 4339606, + "id": 38122398, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:f2cef38399c7be66f9df604405e801ec2b2472d03c6cfeadae73c72b913b6bc3", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 157202688, + "status": "active", + "last_pulled": "2022-01-18T11:27:06.602538Z", + "last_pushed": "2022-11-08T11:06:03.22883Z" + } + ], + "last_updated": "2022-11-08T11:06:03.22883Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.4.0", + "repository": 2072215, + "full_size": 157202688, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:06.602538Z", + "tag_last_pushed": "2022-11-08T11:06:03.22883Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:f2cef38399c7be66f9df604405e801ec2b2472d03c6cfeadae73c72b913b6bc3" + }, + { + "creator": 4339606, + "id": 38122048, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:062a5498aeecfc4b811a5622caed09c646e990a90c3949a74b9322a94a82c88c", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 163948477, + "status": "active", + "last_pulled": "2022-01-18T11:27:05.97255Z", + "last_pushed": "2022-11-08T11:05:53.36546Z" + } + ], + "last_updated": "2022-11-08T11:05:53.36546Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.1", + "repository": 2072215, + "full_size": 163948477, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:05.97255Z", + "tag_last_pushed": "2022-11-08T11:05:53.36546Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:062a5498aeecfc4b811a5622caed09c646e990a90c3949a74b9322a94a82c88c" + }, + { + "creator": 4339606, + "id": 38121837, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:35745e346218e2e2eb38107beebc728d63d4f06275d45aa1d764c280ab4fd88e", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 155070350, + "status": "active", + "last_pulled": "2022-01-18T11:27:05.345194Z", + "last_pushed": "2022-11-08T11:05:39.428958Z" + } + ], + "last_updated": "2022-11-08T11:05:39.428958Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.3.0", + "repository": 2072215, + "full_size": 155070350, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-18T11:27:05.345194Z", + "tag_last_pushed": "2022-11-08T11:05:39.428958Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:35745e346218e2e2eb38107beebc728d63d4f06275d45aa1d764c280ab4fd88e" + }, + { + "creator": 2325232, + "id": 18139766, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:94817a898d8fb8c8cf026d50e1f6cfba33a1ffcce0b509f839453fc0151f8a8d", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 263397032, + "status": "inactive", + "last_pulled": "2022-08-24T11:48:42.659535Z", + "last_pushed": null + } + ], + "last_updated": "2017-11-17T02:45:28.016607Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "v1.0.0", + "repository": 2072215, + "full_size": 263397032, + "v2": true, + "tag_status": "inactive", + "tag_last_pulled": "2022-08-24T11:48:42.659535Z", + "tag_last_pushed": "2017-11-17T02:45:28.016607Z", + "media_type": "application/vnd.docker.container.image.v1+json" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page1.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page1.json new file mode 100644 index 00000000..a0ebc41b --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page1.json @@ -0,0 +1,317 @@ +{ + "count": 42, + "next": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=2", + "previous": null, + "results": [ + { + "creator": 2325232, + "id": 319290830, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:c8c341df3a7d463e48cd5e341e15f21a7198fe0d9c293c91700e96b996f1ab0f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 557234034, + "status": "active", + "last_pulled": null, + "last_pushed": "2022-11-16T13:40:49.233111Z" + } + ], + "last_updated": "2022-11-16T13:40:49.233111Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.4.1", + "repository": 7064140, + "full_size": 557234034, + "v2": true, + "tag_status": "active", + "tag_last_pulled": null, + "tag_last_pushed": "2022-11-16T13:40:49.233111Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:c8c341df3a7d463e48cd5e341e15f21a7198fe0d9c293c91700e96b996f1ab0f" + }, + { + "creator": 2325232, + "id": 300703414, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:d17567d5a3d0020af6f2064bc65cba124d64b7e7e815f7e0f7e25b7e3b37ca17", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 557307197, + "status": "active", + "last_pulled": null, + "last_pushed": "2022-11-16T13:40:21.200002Z" + } + ], + "last_updated": "2022-11-16T13:40:21.200002Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.4.0", + "repository": 7064140, + "full_size": 557307197, + "v2": true, + "tag_status": "active", + "tag_last_pulled": null, + "tag_last_pushed": "2022-11-16T13:40:21.200002Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:d17567d5a3d0020af6f2064bc65cba124d64b7e7e815f7e0f7e25b7e3b37ca17" + }, + { + "creator": 2325232, + "id": 231797340, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:96bc38224a577b91c97c6f0d6c7c0dd0e959d386b69dd2fe58f4f289cd2b977f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 537481235, + "status": "active", + "last_pulled": null, + "last_pushed": "2022-11-16T13:39:56.851344Z" + } + ], + "last_updated": "2022-11-16T13:39:56.851344Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.3.2", + "repository": 7064140, + "full_size": 537481235, + "v2": true, + "tag_status": "active", + "tag_last_pulled": null, + "tag_last_pushed": "2022-11-16T13:39:56.851344Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:96bc38224a577b91c97c6f0d6c7c0dd0e959d386b69dd2fe58f4f289cd2b977f" + }, + { + "creator": 2325232, + "id": 216161298, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:1009b24d074d2ce0a63f96b9d45d75ca2f99f20b79538e29783238baf60d9137", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 537447461, + "status": "active", + "last_pulled": null, + "last_pushed": "2022-11-16T13:39:30.318668Z" + } + ], + "last_updated": "2022-11-16T13:39:30.318668Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.3.1", + "repository": 7064140, + "full_size": 537447461, + "v2": true, + "tag_status": "active", + "tag_last_pulled": null, + "tag_last_pushed": "2022-11-16T13:39:30.318668Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:1009b24d074d2ce0a63f96b9d45d75ca2f99f20b79538e29783238baf60d9137" + }, + { + "creator": 2325232, + "id": 202282304, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:b539ba31e9f4a104ea1992de6aad618f459cc3d6cd6054b38cbe1e4c4f158539", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 537429155, + "status": "active", + "last_pulled": null, + "last_pushed": "2022-11-16T13:39:01.871341Z" + } + ], + "last_updated": "2022-11-16T13:39:01.871341Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.3.0", + "repository": 7064140, + "full_size": 537429155, + "v2": true, + "tag_status": "active", + "tag_last_pulled": null, + "tag_last_pushed": "2022-11-16T13:39:01.871341Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:b539ba31e9f4a104ea1992de6aad618f459cc3d6cd6054b38cbe1e4c4f158539" + }, + { + "creator": 2325232, + "id": 198097412, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:5e85af277d3e23e57ad42769dde8861d7dfa9b9711b70274ce55ca04e2ee1ddf", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 580481229, + "status": "active", + "last_pulled": "2022-08-24T11:25:32.006305Z", + "last_pushed": "2022-11-16T13:38:33.483004Z" + } + ], + "last_updated": "2022-11-16T13:38:33.483004Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.2.5", + "repository": 7064140, + "full_size": 580481229, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-24T11:25:32.006305Z", + "tag_last_pushed": "2022-11-16T13:38:33.483004Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:5e85af277d3e23e57ad42769dde8861d7dfa9b9711b70274ce55ca04e2ee1ddf" + }, + { + "creator": 2325232, + "id": 198091265, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:6184fb1b23a69ba2e73fb0f4f595edccf62b46791d0e589c1af6d446f68f075a", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 580504291, + "status": "active", + "last_pulled": "2022-06-06T12:29:54.613443Z", + "last_pushed": "2022-11-16T13:38:04.297666Z" + } + ], + "last_updated": "2022-11-16T13:38:04.297666Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.2.4", + "repository": 7064140, + "full_size": 580504291, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-06-06T12:29:54.613443Z", + "tag_last_pushed": "2022-11-16T13:38:04.297666Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:6184fb1b23a69ba2e73fb0f4f595edccf62b46791d0e589c1af6d446f68f075a" + }, + { + "creator": 2325232, + "id": 177092981, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:f300a7cd3378d99897515e9dac2024c6cba7e4425d86d191d2c48a2b60091586", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 580986927, + "status": "active", + "last_pulled": "2022-08-24T11:25:29.775542Z", + "last_pushed": "2022-11-16T13:37:31.443813Z" + } + ], + "last_updated": "2022-11-16T13:37:31.443813Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.2.3", + "repository": 7064140, + "full_size": 580986927, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-24T11:25:29.775542Z", + "tag_last_pushed": "2022-11-16T13:37:31.443813Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:f300a7cd3378d99897515e9dac2024c6cba7e4425d86d191d2c48a2b60091586" + }, + { + "creator": 2325232, + "id": 175682766, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:95a9cdf323df0682bee5f8fd63fc52f3eb37e32273908ea4c4c1f22a847fb8ea", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 580979955, + "status": "active", + "last_pulled": "2021-12-16T11:51:10.431711Z", + "last_pushed": "2022-11-16T13:37:03.075995Z" + } + ], + "last_updated": "2022-11-16T13:37:03.075995Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.2.2", + "repository": 7064140, + "full_size": 580979955, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2021-12-16T11:51:10.431711Z", + "tag_last_pushed": "2022-11-16T13:37:03.075995Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:95a9cdf323df0682bee5f8fd63fc52f3eb37e32273908ea4c4c1f22a847fb8ea" + }, + { + "creator": 2325232, + "id": 173671347, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:4fd70b603a9db4be8f25ef19d2418e6d90c2283e7efbbcb0301e79f600c4c672", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 580979664, + "status": "active", + "last_pulled": "2021-12-16T11:50:37.482713Z", + "last_pushed": "2022-11-16T13:36:27.782756Z" + } + ], + "last_updated": "2022-11-16T13:36:27.782756Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.2.1", + "repository": 7064140, + "full_size": 580979664, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2021-12-16T11:50:37.482713Z", + "tag_last_pushed": "2022-11-16T13:36:27.782756Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:4fd70b603a9db4be8f25ef19d2418e6d90c2283e7efbbcb0301e79f600c4c672" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page2.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page2.json new file mode 100644 index 00000000..fe469f6f --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page2.json @@ -0,0 +1,317 @@ +{ + "count": 42, + "next": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=3", + "previous": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=1", + "results": [ + { + "creator": 2325232, + "id": 168220529, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:7d68b91ad987e3cd4c96e21573d02752220bd447a1c554018748aef0bb1b9491", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 580955040, + "status": "active", + "last_pulled": "2021-12-16T11:50:10.861667Z", + "last_pushed": "2022-11-16T13:35:51.488548Z" + } + ], + "last_updated": "2022-11-16T13:35:51.488548Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.2.0", + "repository": 7064140, + "full_size": 580955040, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2021-12-16T11:50:10.861667Z", + "tag_last_pushed": "2022-11-16T13:35:51.488548Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:7d68b91ad987e3cd4c96e21573d02752220bd447a1c554018748aef0bb1b9491" + }, + { + "creator": 2325232, + "id": 149363229, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:3a19cf816d4f1a8f2c8f33ad5d47d4501dca4f254df311d3d7f4003c10aae24f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1743837867, + "status": "active", + "last_pulled": "2022-02-05T14:17:04.793947Z", + "last_pushed": "2022-11-16T13:35:22.871033Z" + } + ], + "last_updated": "2022-11-16T13:35:22.871033Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.6", + "repository": 7064140, + "full_size": 1743837867, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-05T14:17:04.793947Z", + "tag_last_pushed": "2022-11-16T13:35:22.871033Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:3a19cf816d4f1a8f2c8f33ad5d47d4501dca4f254df311d3d7f4003c10aae24f" + }, + { + "creator": 2325232, + "id": 146492194, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:9a0ad78746595951a624b4af446749822123bc53a03c1f6671b830ebabce2c62", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1710924778, + "status": "active", + "last_pulled": "2022-01-20T14:21:26.501583Z", + "last_pushed": "2022-11-16T13:33:59.078685Z" + } + ], + "last_updated": "2022-11-16T13:33:59.078685Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.5", + "repository": 7064140, + "full_size": 1710924778, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:21:26.501583Z", + "tag_last_pushed": "2022-11-16T13:33:59.078685Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:9a0ad78746595951a624b4af446749822123bc53a03c1f6671b830ebabce2c62" + }, + { + "creator": 2325232, + "id": 145350103, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:5d0913951aff6d6aeeafb55f3e97e2764bc56ba3ff88c44367f29118755a4b72", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1710720560, + "status": "active", + "last_pulled": "2022-01-20T14:21:21.91038Z", + "last_pushed": "2022-11-16T13:32:48.632539Z" + } + ], + "last_updated": "2022-11-16T13:32:48.632539Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.4", + "repository": 7064140, + "full_size": 1710720560, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:21:21.91038Z", + "tag_last_pushed": "2022-11-16T13:32:48.632539Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:5d0913951aff6d6aeeafb55f3e97e2764bc56ba3ff88c44367f29118755a4b72" + }, + { + "creator": 2325232, + "id": 143253236, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:64c74364af7e8644961f7bc4c001521f3513c1843b0f166c5b69b901a03f906e", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1710674609, + "status": "active", + "last_pulled": "2022-01-20T14:21:17.588257Z", + "last_pushed": "2022-11-16T13:31:40.950483Z" + } + ], + "last_updated": "2022-11-16T13:31:40.950483Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.3", + "repository": 7064140, + "full_size": 1710674609, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:21:17.588257Z", + "tag_last_pushed": "2022-11-16T13:31:40.950483Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:64c74364af7e8644961f7bc4c001521f3513c1843b0f166c5b69b901a03f906e" + }, + { + "creator": 2325232, + "id": 139320874, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:0d3bff0f3c36a4fd73e0d246c101166b51ce449056a2776ff190a17fda731a65", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1710305211, + "status": "active", + "last_pulled": "2022-04-20T14:31:35.3423Z", + "last_pushed": "2022-11-16T13:30:41.614314Z" + } + ], + "last_updated": "2022-11-16T13:30:41.614314Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.2", + "repository": 7064140, + "full_size": 1710305211, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-04-20T14:31:35.3423Z", + "tag_last_pushed": "2022-11-16T13:30:41.614314Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:0d3bff0f3c36a4fd73e0d246c101166b51ce449056a2776ff190a17fda731a65" + }, + { + "creator": 2325232, + "id": 139208499, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:a66511bb6b6b6f3681d7ca8c8a8c9e495de2b03223573b844ece5234447ad218", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1710306113, + "status": "active", + "last_pulled": "2022-01-20T14:21:07.400802Z", + "last_pushed": "2022-11-16T13:29:38.834575Z" + } + ], + "last_updated": "2022-11-16T13:29:38.834575Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.1", + "repository": 7064140, + "full_size": 1710306113, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:21:07.400802Z", + "tag_last_pushed": "2022-11-16T13:29:38.834575Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:a66511bb6b6b6f3681d7ca8c8a8c9e495de2b03223573b844ece5234447ad218" + }, + { + "creator": 2325232, + "id": 129144087, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:a396267f73028c2a6f821af71c0ba655b63bd75e22aafa37a0ea763eb58ea5d2", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1726528846, + "status": "active", + "last_pulled": "2022-01-20T14:21:02.016346Z", + "last_pushed": "2022-11-16T13:28:33.417147Z" + } + ], + "last_updated": "2022-11-16T13:28:33.417147Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.1.0", + "repository": 7064140, + "full_size": 1726528846, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:21:02.016346Z", + "tag_last_pushed": "2022-11-16T13:28:33.417147Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:a396267f73028c2a6f821af71c0ba655b63bd75e22aafa37a0ea763eb58ea5d2" + }, + { + "creator": 2325232, + "id": 139030898, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:69d2026974b71dee96e8dfc6bfa082bd449f13f71b4a6c27bcddfef4dcfb5d47", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1783918156, + "status": "active", + "last_pulled": "2022-02-06T01:12:00.809148Z", + "last_pushed": "2022-11-16T13:27:34.63867Z" + } + ], + "last_updated": "2022-11-16T13:27:34.63867Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.6", + "repository": 7064140, + "full_size": 1783918156, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-06T01:12:00.809148Z", + "tag_last_pushed": "2022-11-16T13:27:34.63867Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:69d2026974b71dee96e8dfc6bfa082bd449f13f71b4a6c27bcddfef4dcfb5d47" + }, + { + "creator": 2325232, + "id": 133052976, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:a6a7650ee718ce27f3b771b322ce4c2bed146ebcedd086f26b195a4a44a9ea96", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1783925950, + "status": "active", + "last_pulled": "2022-08-24T11:24:08.189909Z", + "last_pushed": "2022-11-16T13:26:34.92798Z" + } + ], + "last_updated": "2022-11-16T13:26:34.92798Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.5", + "repository": 7064140, + "full_size": 1783925950, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-24T11:24:08.189909Z", + "tag_last_pushed": "2022-11-16T13:26:34.92798Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:a6a7650ee718ce27f3b771b322ce4c2bed146ebcedd086f26b195a4a44a9ea96" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page3.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page3.json new file mode 100644 index 00000000..3bf4056f --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page3.json @@ -0,0 +1,317 @@ +{ + "count": 42, + "next": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=4", + "previous": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=2", + "results": [ + { + "creator": 2325232, + "id": 126784717, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:1c64b4718b271b33d49f9a589065e0d4752e44a56d77ea3e870e25224aeb977c", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1783639501, + "status": "active", + "last_pulled": "2022-08-24T11:24:07.221345Z", + "last_pushed": "2022-11-16T13:25:47.520028Z" + } + ], + "last_updated": "2022-11-16T13:25:47.520028Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.4", + "repository": 7064140, + "full_size": 1783639501, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-24T11:24:07.221345Z", + "tag_last_pushed": "2022-11-16T13:25:47.520028Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:1c64b4718b271b33d49f9a589065e0d4752e44a56d77ea3e870e25224aeb977c" + }, + { + "creator": 2325232, + "id": 124437267, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:3398e38eeb87decf5529a8d1bc38108137e94f868d0e7e30314dc1d1b006cd79", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1784416792, + "status": "active", + "last_pulled": "2022-08-24T11:24:06.207852Z", + "last_pushed": "2022-11-16T13:24:50.149747Z" + } + ], + "last_updated": "2022-11-16T13:24:50.149747Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.3", + "repository": 7064140, + "full_size": 1784416792, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-24T11:24:06.207852Z", + "tag_last_pushed": "2022-11-16T13:24:50.149747Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:3398e38eeb87decf5529a8d1bc38108137e94f868d0e7e30314dc1d1b006cd79" + }, + { + "creator": 2325232, + "id": 120768498, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:74db5d3d82ff3b7c79af4eebff9001bf9a63187636b7fc62889534f85c45fa85", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1784220894, + "status": "active", + "last_pulled": "2022-01-20T14:20:31.661287Z", + "last_pushed": "2022-11-16T13:23:46.717471Z" + } + ], + "last_updated": "2022-11-16T13:23:46.717471Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.2", + "repository": 7064140, + "full_size": 1784220894, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:20:31.661287Z", + "tag_last_pushed": "2022-11-16T13:23:46.717471Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:74db5d3d82ff3b7c79af4eebff9001bf9a63187636b7fc62889534f85c45fa85" + }, + { + "creator": 2325232, + "id": 117314098, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:4b0b3ba9c73b03d251cbac7b68541a72b3eaa841a0c401f0725b33d7411eac04", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1784117813, + "status": "active", + "last_pulled": "2022-01-20T14:20:26.947034Z", + "last_pushed": "2022-11-16T13:22:37.215573Z" + } + ], + "last_updated": "2022-11-16T13:22:37.215573Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.1", + "repository": 7064140, + "full_size": 1784117813, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:20:26.947034Z", + "tag_last_pushed": "2022-11-16T13:22:37.215573Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:4b0b3ba9c73b03d251cbac7b68541a72b3eaa841a0c401f0725b33d7411eac04" + }, + { + "creator": 2325232, + "id": 114100594, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:551381df5b9e2785f78e75d1c7368c4444630bcc895c7e62cf070cfa0c67479b", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1567296220, + "status": "active", + "last_pulled": "2022-01-20T14:20:22.393997Z", + "last_pushed": "2022-11-16T13:21:14.021755Z" + } + ], + "last_updated": "2022-11-16T13:21:14.021755Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "2.0.0", + "repository": 7064140, + "full_size": 1567296220, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:20:22.393997Z", + "tag_last_pushed": "2022-11-16T13:21:14.021755Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:551381df5b9e2785f78e75d1c7368c4444630bcc895c7e62cf070cfa0c67479b" + }, + { + "creator": 2325232, + "id": 106291502, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:1136aefa92392d05515d035bcbd7fb6fda970cc4f1b12ad6f501c5c9bdf82be8", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1618698404, + "status": "active", + "last_pulled": "2022-03-09T00:47:44.603844Z", + "last_pushed": "2022-11-16T13:20:13.926127Z" + } + ], + "last_updated": "2022-11-16T13:20:13.926127Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.8.4", + "repository": 7064140, + "full_size": 1618698404, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-03-09T00:47:44.603844Z", + "tag_last_pushed": "2022-11-16T13:20:13.926127Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:1136aefa92392d05515d035bcbd7fb6fda970cc4f1b12ad6f501c5c9bdf82be8" + }, + { + "creator": 2325232, + "id": 102366206, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:b032a6384bfaef81e187c3e93069d0da6b23237df8090f6376de0663c949b671", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1618682554, + "status": "active", + "last_pulled": "2022-08-24T11:23:42.222797Z", + "last_pushed": "2022-11-16T13:19:13.136936Z" + } + ], + "last_updated": "2022-11-16T13:19:13.136936Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.8.3", + "repository": 7064140, + "full_size": 1618682554, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-08-24T11:23:42.222797Z", + "tag_last_pushed": "2022-11-16T13:19:13.136936Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:b032a6384bfaef81e187c3e93069d0da6b23237df8090f6376de0663c949b671" + }, + { + "creator": 2325232, + "id": 99312399, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:b7ca22db55e41d5844f5f21efb347c4180dc94a7b3dd0f861ad05ef0125664f6", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1653216334, + "status": "active", + "last_pulled": "2022-04-20T14:31:35.802705Z", + "last_pushed": "2022-11-16T13:18:19.671405Z" + } + ], + "last_updated": "2022-11-16T13:18:19.671405Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.8.2", + "repository": 7064140, + "full_size": 1653216334, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-04-20T14:31:35.802705Z", + "tag_last_pushed": "2022-11-16T13:18:19.671405Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:b7ca22db55e41d5844f5f21efb347c4180dc94a7b3dd0f861ad05ef0125664f6" + }, + { + "creator": 2325232, + "id": 95733092, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:e8d7e8eb39551ca345b796aff0a068e1a7e954bb9e773d0abed21652bdf934f3", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1618529055, + "status": "active", + "last_pulled": "2022-01-20T14:19:54.674843Z", + "last_pushed": "2022-11-16T13:17:34.009459Z" + } + ], + "last_updated": "2022-11-16T13:17:34.009459Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.8.1", + "repository": 7064140, + "full_size": 1618529055, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:19:54.674843Z", + "tag_last_pushed": "2022-11-16T13:17:34.009459Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:e8d7e8eb39551ca345b796aff0a068e1a7e954bb9e773d0abed21652bdf934f3" + }, + { + "creator": 2325232, + "id": 92403095, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:7ecdd15f8f2bef71d770f543674eaf93fe1dcc15160b9d1c5146ee74e6778021", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1618508328, + "status": "active", + "last_pulled": "2022-04-20T14:31:35.817774Z", + "last_pushed": "2022-11-16T13:16:44.766502Z" + } + ], + "last_updated": "2022-11-16T13:16:44.766502Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.8.0", + "repository": 7064140, + "full_size": 1618508328, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-04-20T14:31:35.817774Z", + "tag_last_pushed": "2022-11-16T13:16:44.766502Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:7ecdd15f8f2bef71d770f543674eaf93fe1dcc15160b9d1c5146ee74e6778021" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page4.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page4.json new file mode 100644 index 00000000..e4215966 --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page4.json @@ -0,0 +1,317 @@ +{ + "count": 42, + "next": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=5", + "previous": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=3", + "results": [ + { + "creator": 2325232, + "id": 86519831, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:9f267d805f0b0f24b473a5dbe43b0026aeb9859c9ab0f7ca5f4eb592564d5f79", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1866663849, + "status": "active", + "last_pulled": "2022-04-20T14:31:35.875081Z", + "last_pushed": "2022-11-16T13:15:56.940484Z" + } + ], + "last_updated": "2022-11-16T13:15:56.940484Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.7", + "repository": 7064140, + "full_size": 1866663849, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-04-20T14:31:35.875081Z", + "tag_last_pushed": "2022-11-16T13:15:56.940484Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:9f267d805f0b0f24b473a5dbe43b0026aeb9859c9ab0f7ca5f4eb592564d5f79" + }, + { + "creator": 2325232, + "id": 75502051, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:d594308d59a0bd0bcabf868878ed74c86d520b1f67aef80e152aa984fac90a60", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1866663885, + "status": "active", + "last_pulled": "2022-01-20T14:19:35.564333Z", + "last_pushed": "2022-11-16T13:15:07.432238Z" + } + ], + "last_updated": "2022-11-16T13:15:07.432238Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.6", + "repository": 7064140, + "full_size": 1866663885, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:19:35.564333Z", + "tag_last_pushed": "2022-11-16T13:15:07.432238Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:d594308d59a0bd0bcabf868878ed74c86d520b1f67aef80e152aa984fac90a60" + }, + { + "creator": 4339606, + "id": 74521115, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:b5f8ccd16c5d4943c01ba4425a11e5d508cf24f7dcfc2374bdb6ee7d1500f55f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1866662646, + "status": "active", + "last_pulled": "2022-01-20T14:19:30.855879Z", + "last_pushed": "2022-11-16T13:14:21.057364Z" + } + ], + "last_updated": "2022-11-16T13:14:21.057364Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.5", + "repository": 7064140, + "full_size": 1866662646, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:19:30.855879Z", + "tag_last_pushed": "2022-11-16T13:14:21.057364Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:b5f8ccd16c5d4943c01ba4425a11e5d508cf24f7dcfc2374bdb6ee7d1500f55f" + }, + { + "creator": 4339606, + "id": 72399236, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:d5dc924c6d208a9b1430d111ad4d8fcfa14a4bbbccc9359055b4792cc751c48c", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1866661787, + "status": "active", + "last_pulled": "2022-01-20T14:19:25.102659Z", + "last_pushed": "2022-11-16T13:13:25.609257Z" + } + ], + "last_updated": "2022-11-16T13:13:25.609257Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.4", + "repository": 7064140, + "full_size": 1866661787, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:19:25.102659Z", + "tag_last_pushed": "2022-11-16T13:13:25.609257Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:d5dc924c6d208a9b1430d111ad4d8fcfa14a4bbbccc9359055b4792cc751c48c" + }, + { + "creator": 4339606, + "id": 69657625, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:a835b22bc81277eff53c1d01fc6f9fa4e5a4a9b2bb6903a25f238852176c434f", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1866627245, + "status": "active", + "last_pulled": "2022-01-20T14:19:19.575063Z", + "last_pushed": "2022-11-16T13:12:35.765396Z" + } + ], + "last_updated": "2022-11-16T13:12:35.765396Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.3", + "repository": 7064140, + "full_size": 1866627245, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:19:19.575063Z", + "tag_last_pushed": "2022-11-16T13:12:35.765396Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:a835b22bc81277eff53c1d01fc6f9fa4e5a4a9b2bb6903a25f238852176c434f" + }, + { + "creator": 4339606, + "id": 68728343, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:67e6ac958e456b5bb874551031100583d9a9a18876394a4292862d46d6203612", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1870158548, + "status": "active", + "last_pulled": "2022-01-20T14:19:09.734966Z", + "last_pushed": "2022-11-16T13:11:51.098751Z" + } + ], + "last_updated": "2022-11-16T13:11:51.098751Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.7.0", + "repository": 7064140, + "full_size": 1870158548, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:19:09.734966Z", + "tag_last_pushed": "2022-11-16T13:11:51.098751Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:67e6ac958e456b5bb874551031100583d9a9a18876394a4292862d46d6203612" + }, + { + "creator": 2325232, + "id": 66086256, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:63844b4d48ba9d14021aa12f0c03dc8ba2f02e805440671bc860b9ef28afdc51", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1392223248, + "status": "active", + "last_pulled": "2022-01-30T23:29:26.218486Z", + "last_pushed": "2022-11-16T13:10:02.890139Z" + } + ], + "last_updated": "2022-11-16T13:10:02.890139Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.6.2", + "repository": 7064140, + "full_size": 1392223248, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-30T23:29:26.218486Z", + "tag_last_pushed": "2022-11-16T13:10:02.890139Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:63844b4d48ba9d14021aa12f0c03dc8ba2f02e805440671bc860b9ef28afdc51" + }, + { + "creator": 4339606, + "id": 64995886, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:97483f4fe3aa22cb47a81370e694732cc7eb62cea2dfc44624c3850123a6fdb0", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1392223289, + "status": "active", + "last_pulled": "2022-02-05T01:50:16.405256Z", + "last_pushed": "2022-11-16T13:09:21.461395Z" + } + ], + "last_updated": "2022-11-16T13:09:21.461395Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.6.1", + "repository": 7064140, + "full_size": 1392223289, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-05T01:50:16.405256Z", + "tag_last_pushed": "2022-11-16T13:09:21.461395Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:97483f4fe3aa22cb47a81370e694732cc7eb62cea2dfc44624c3850123a6fdb0" + }, + { + "creator": 4339606, + "id": 58574899, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:00c8b9ee66f3946587f17b4b85bd92f0ee4900b8e0e9aea29a9a5d964d4491c5", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1569875957, + "status": "active", + "last_pulled": "2022-01-20T14:18:26.299847Z", + "last_pushed": "2022-11-16T13:08:28.846158Z" + } + ], + "last_updated": "2022-11-16T13:08:28.846158Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.5.4", + "repository": 7064140, + "full_size": 1569875957, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-01-20T14:18:26.299847Z", + "tag_last_pushed": "2022-11-16T13:08:28.846158Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:00c8b9ee66f3946587f17b4b85bd92f0ee4900b8e0e9aea29a9a5d964d4491c5" + }, + { + "creator": 4339606, + "id": 58454309, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:891daa9ad34c10054250e08dfed933be8898fc25c972b0c5a2093305065cc3e7", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1569874967, + "status": "active", + "last_pulled": "2022-02-07T11:21:31.959403Z", + "last_pushed": "2022-11-16T13:07:40.936216Z" + } + ], + "last_updated": "2022-11-16T13:07:40.936216Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.5.3", + "repository": 7064140, + "full_size": 1569874967, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-07T11:21:31.959403Z", + "tag_last_pushed": "2022-11-16T13:07:40.936216Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:891daa9ad34c10054250e08dfed933be8898fc25c972b0c5a2093305065cc3e7" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page5.json b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page5.json new file mode 100644 index 00000000..c2b06cae --- /dev/null +++ b/tests/fixtures/nexus/releasedockerhub_dockertags-sdnc-aaf-image-page5.json @@ -0,0 +1,69 @@ +{ + "count": 42, + "next": null, + "previous": "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=4", + "results": [ + { + "creator": 4339606, + "id": 57694535, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:0e01ba850ed37e4d89e5122e3698e1646cd2bbf1be6d89321255a7f588592710", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1569924376, + "status": "active", + "last_pulled": "2022-02-02T13:32:22.413626Z", + "last_pushed": "2022-11-16T13:06:46.573469Z" + } + ], + "last_updated": "2022-11-16T13:06:46.573469Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.5.2", + "repository": 7064140, + "full_size": 1569924376, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-02T13:32:22.413626Z", + "tag_last_pushed": "2022-11-16T13:06:46.573469Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:0e01ba850ed37e4d89e5122e3698e1646cd2bbf1be6d89321255a7f588592710" + }, + { + "creator": 4339606, + "id": 54428440, + "images": [ + { + "architecture": "amd64", + "features": "", + "variant": null, + "digest": "sha256:9ea6e1cb24d152c06e70fd22c8861ace254e4f1f9fae0803cc1afd7f4cbfa967", + "os": "linux", + "os_features": "", + "os_version": null, + "size": 1565679062, + "status": "active", + "last_pulled": "2022-02-04T13:10:58.69163Z", + "last_pushed": "2022-11-16T13:05:54.608807Z" + } + ], + "last_updated": "2022-11-16T13:05:54.608807Z", + "last_updater": 2325232, + "last_updater_username": "onapdockerhub", + "name": "1.5.1", + "repository": 7064140, + "full_size": 1565679062, + "v2": true, + "tag_status": "active", + "tag_last_pulled": "2022-02-04T13:10:58.69163Z", + "tag_last_pushed": "2022-11-16T13:05:54.608807Z", + "media_type": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:9ea6e1cb24d152c06e70fd22c8861ace254e4f1f9fae0803cc1afd7f4cbfa967" + } + ] +} \ No newline at end of file diff --git a/tests/test_release_docker_hub.py b/tests/test_release_docker_hub.py index 578229db..98cf7617 100644 --- a/tests/test_release_docker_hub.py +++ b/tests/test_release_docker_hub.py @@ -23,6 +23,12 @@ FIXTURE_DIR = os.path.join( ) +def data_from_file(filename): + """Return content from file""" + with open(filename, "r") as f: + return f.read() + + def test_remove_http_from_url(): """Test _remove_http_from_url.""" test_url = [ @@ -60,11 +66,13 @@ def test_format_image_id(): def test_nexus_tag_class(responses): """Test NexusTagClass""" org = "onap" - repo = "base/sdc-sanity" + repo = "sdc-helm-validator" repo_from_file = False - url = "https://nexus3.onap.org:10002/v2/onap/base/sdc-sanity/tags/list" - answer = '{"name":"onap/base_sdc-sanity","tags":["latest","1.3.0","1.3.1","1.4.0","1.4.1","v1.0.0"]}' - answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1"] + url = "https://nexus3.onap.org:10002/v2/onap/sdc-helm-validator/tags/list" + answer = ( + '{"name":"onap/sdc-helm-validator","tags":["latest","1.3.0","1.3.1","1.4.0","1.4.1","1.6.0","1.7.0","v1.0.0"]}' + ) + answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1", "1.6.0", "1.7.0"] answer_invalid_tags = ["latest", "v1.0.0"] responses.add(responses.GET, url, body=answer, status=200) rdh.initialize(org) @@ -77,20 +85,17 @@ def test_nexus_tag_class(responses): assert len(test_tags.invalid) == len(answer_invalid_tags) -def test_docker_tag_class(responses): +@pytest.mark.datafiles( + os.path.join(FIXTURE_DIR, "nexus"), +) +def test_docker_tag_class(responses, datafiles): """Test DockerTagClass""" org = "onap" - repo = "base-sdc-sanity" + repo = "sdc-helm-validator" repo_from_file = False - url = "https://registry.hub.docker.com/v1/repositories/onap/base-sdc-sanity/tags" - answer = """[{"layer": "", "name": "latest"}, - {"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, - {"layer": "", "name": "1.4.0"}, - {"layer": "", "name": "1.4.1"}, - {"layer": "", "name": "v1.0.0"}] - """ - answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1"] + url = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdc-helm-validator/tags" + answer = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdc-helm-validator.json")) + answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1", "1.6.0", "1.7.0"] answer_invalid_tags = ["latest", "v1.0.0"] responses.add(responses.GET, url, body=answer, status=200) rdh.initialize(org) @@ -103,23 +108,97 @@ def test_docker_tag_class(responses): assert len(test_tags.invalid) == len(answer_invalid_tags) -def test_docker_tag_err_429_class(responses, mocker): +@pytest.mark.datafiles( + os.path.join(FIXTURE_DIR, "nexus"), +) +def test_multiple_pages_4_dockertags(responses, datafiles): + org = "onap" + repo = "sdnc-aaf-image" + repo_from_file = False + url1 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags" + url2 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=2" + url3 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=3" + url4 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=4" + url5 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdnc-aaf-image/tags?page=5" + answer1 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdnc-aaf-image-page1.json")) + answer2 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdnc-aaf-image-page2.json")) + answer3 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdnc-aaf-image-page3.json")) + answer4 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdnc-aaf-image-page4.json")) + answer5 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdnc-aaf-image-page5.json")) + answer_valid_tags = [ + "1.5.1", + "1.5.2", + "1.5.3", + "1.5.4", + "1.6.1", + "1.6.2", + "1.7.0", + "1.7.3", + "1.7.4", + "1.7.5", + "1.7.6", + "1.7.7", + "1.8.0", + "1.8.1", + "1.8.2", + "1.8.3", + "1.8.4", + "2.0.0", + "2.0.1", + "2.0.2", + "2.0.3", + "2.0.4", + "2.0.5", + "2.0.6", + "2.1.0", + "2.1.1", + "2.1.2", + "2.1.3", + "2.1.4", + "2.1.5", + "2.1.6", + "2.2.0", + "2.2.1", + "2.2.2", + "2.2.3", + "2.2.4", + "2.2.5", + "2.3.0", + "2.3.1", + "2.3.2", + "2.4.0", + "2.4.1", + ] + answer_invalid_tags = [] + responses.add(responses.GET, url1, body=answer1, status=200) + responses.add(responses.GET, url2, body=answer2, status=200) + responses.add(responses.GET, url3, body=answer3, status=200) + responses.add(responses.GET, url4, body=answer4, status=200) + responses.add(responses.GET, url5, body=answer5, status=200) + rdh.initialize(org) + test_tags = rdh.DockerTagClass(org, repo, repo_from_file) + for tag in answer_valid_tags: + assert tag in test_tags.valid + for tag in answer_invalid_tags: + assert tag in test_tags.invalid + assert len(test_tags.valid) == len(answer_valid_tags) + assert len(test_tags.invalid) == len(answer_invalid_tags) + + +@pytest.mark.datafiles( + os.path.join(FIXTURE_DIR, "nexus"), +) +def test_docker_tag_err_429_class(responses, datafiles, mocker): """Test DockerTagClass""" mocker.patch("time.sleep", return_value=None) org = "onap" - repo = "base-sdc-sanity" + repo = "sdc-helm-validator" repo_from_file = False - url = "https://registry.hub.docker.com/v1/repositories/onap/base-sdc-sanity/tags" - answer = """[{"layer": "", "name": "latest"}, - {"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, - {"layer": "", "name": "1.4.0"}, - {"layer": "", "name": "1.4.1"}, - {"layer": "", "name": "v1.0.0"}] - """ - answer_429 = '{"detail": "Rate limit exceeded", "error": false}"' - answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1"] + url = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdc-helm-validator/tags" + answer = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-sdc-helm-validator.json")) + answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1", "1.6.0", "1.7.0"] answer_invalid_tags = ["latest", "v1.0.0"] + answer_429 = '{"detail": "Rate limit exceeded", "error": false}"' rdh.initialize(org) # Do 19 failed and next one should work @@ -140,7 +219,7 @@ def test_docker_tag_err_429_class(responses, mocker): def test_tag_class_repository_exist(): """Test TagClass""" org = "onap" - repo = "base/sdc-sanity" + repo = "sdc-helm-validator" repo_from_file = False rdh.initialize(org) tags = rdh.TagClass(org, repo, repo_from_file) @@ -159,7 +238,7 @@ class TestTagsRegExpClass: def test_tag_class_valid_tags(self): """Test TagClass""" org = "onap" - repo = "base/sdc-sanity" + repo = "sdc-helm-validator" repo_from_file = False test_tags = ["1.2.3", "1.22.333", "111.22.3", "10.11.12", "1.0.3"] rdh.initialize(org) @@ -172,7 +251,7 @@ class TestTagsRegExpClass: def test_tag_class_invalid_tags(self): """Test TagClass""" org = "onap" - repo = "base/sdc-sanity" + repo = "sdc-helm-validator" repo_from_file = False test_tags = [ @@ -202,7 +281,7 @@ class TestTagsRegExpClass: def test_tag_class_manual_version_regexp_str_valid_tags(self): """Test TagClass""" org = "onap" - repo = "base/sdc-sanity" + repo = "sdc-helm-validator" test_regexp = r"^v\d+.\d+.\d+$" repo_from_file = False test_tags = ["v1.2.3", "v1.22.333", "v111.22.3", "v10.11.12", "v1.0.3"] @@ -216,7 +295,7 @@ class TestTagsRegExpClass: def test_tag_class_manual_version_regexp_str_invalid_tags(self): """Test TagClass""" org = "onap" - repo = "base/sdc-sanity" + repo = "sdc-helm-validator" test_regexp = r"v^\d+.\d+.\d+$" repo_from_file = False test_tags = [ @@ -258,6 +337,9 @@ class TestTagsRegExpClass: assert rdh.VERSION_REGEXP == "[" +@pytest.mark.datafiles( + os.path.join(FIXTURE_DIR, "nexus"), +) class TestProjectClass: """Test ProjectClass. @@ -270,8 +352,8 @@ class TestProjectClass: _test_image_long_id = "sha256:3450464d68c9443dedc8bfe3272a23e6441c37f707c42d32fee0ebdbcd319d2c" _test_image_short_id = "sha256:3450464d68" _expected_nexus_image_str = [ - "nexus3.onap.org:10002/onap/base/sdc-sanity:1.4.0", - "nexus3.onap.org:10002/onap/base/sdc-sanity:1.4.1", + "nexus3.onap.org:10002/onap/sdc-helm-validator:1.4.0", + "nexus3.onap.org:10002/onap/sdc-helm-validator:1.4.1", ] class mock_image: @@ -337,7 +419,7 @@ class TestProjectClass: if self.counter.cleanup <= self.nbr_exc.cleanup: raise requests.exceptions.ConnectionError("Connection Error") - def test_ProjectClass_2_missing(self, responses, mocker): + def test_ProjectClass_2_missing(self, responses, datafiles, mocker): """Test ProjectClass""" mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_pull", side_effect=self.mocked_docker_pull) mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_tag", side_effect=self.mocked_docker_tag) @@ -346,19 +428,18 @@ class TestProjectClass: "lftools.nexus.release_docker_hub.ProjectClass._docker_cleanup", side_effect=self.mocked_docker_cleanup ) - project = ["onap", "base/sdc-sanity", ""] - - nexus_url = "https://nexus3.onap.org:10002/v2/onap/base/sdc-sanity/tags/list" - nexus_answer = '{"name":"onap/base_sdc-sanity","tags":["1.3.0","1.3.1","1.4.0","1.4.1","v1.0.0"]}' - docker_url = "https://registry.hub.docker.com/v1/repositories/onap/base-sdc-sanity/tags" - docker_answer = """[{"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, - {"layer": "", "name": "v1.0.0"}] - """ - nexus_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1"] - nexus_answer_invalid_tags = ["v1.0.0"] - docker_answer_valid_tags = ["1.3.0", "1.3.1"] - docker_answer_invalid_tags = ["v1.0.0"] + project = ["onap", "sdc-helm-validator", ""] + + nexus_url = "https://nexus3.onap.org:10002/v2/onap/sdc-helm-validator/tags/list" + nexus_answer = '{"name":"onap/sdc-helm-validator","tags":["v1.0.0","1.3.0", "1.3.1", "1.4.0", "1.4.1","1.6.0", "1.7.0","latest"]}' + nexus_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1", "1.6.0", "1.7.0"] + nexus_answer_invalid_tags = ["v1.0.0", "latest"] + docker_url = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdc-helm-validator/tags" + docker_answer = data_from_file( + os.path.join(str(datafiles), "releasedockerhub_dockertags-sdc-helm-validator-missing2.json") + ) + docker_answer_valid_tags = ["1.3.0", "1.3.1", "1.6.0", "1.7.0"] + docker_answer_invalid_tags = ["latest", "v1.0.0"] docker_missing_tags = ["1.4.0", "1.4.1"] self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0 @@ -370,9 +451,9 @@ class TestProjectClass: test_proj = rdh.ProjectClass(project) assert test_proj.org_name == "onap" - assert test_proj.nexus_repo_name == "base/sdc-sanity" - assert test_proj.docker_repo_name == "base-sdc-sanity" - assert test_proj.calc_docker_project_name() == "onap/base-sdc-sanity" + assert test_proj.nexus_repo_name == "sdc-helm-validator" + assert test_proj.docker_repo_name == "sdc-helm-validator" + assert test_proj.calc_docker_project_name() == "onap/sdc-helm-validator" assert len(test_proj.nexus_tags.valid) == len(nexus_answer_valid_tags) assert len(test_proj.docker_tags.valid) == len(docker_answer_valid_tags) @@ -390,7 +471,7 @@ class TestProjectClass: assert self.counter.push == 2 assert self.counter.cleanup == 2 - def test_ProjectClass_1_missing(self, responses, mocker): + def test_ProjectClass_1_missing(self, responses, datafiles, mocker): """Test ProjectClass""" mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_pull", side_effect=self.mocked_docker_pull) mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_tag", side_effect=self.mocked_docker_tag) @@ -399,20 +480,21 @@ class TestProjectClass: "lftools.nexus.release_docker_hub.ProjectClass._docker_cleanup", side_effect=self.mocked_docker_cleanup ) - project = ["onap", "base/sdc-sanity", ""] - - nexus_url = "https://nexus3.onap.org:10002/v2/onap/base/sdc-sanity/tags/list" - nexus_answer = '{"name":"onap/base_sdc-sanity","tags":["1.3.0","1.3.1","1.4.0","v1.0.0"]}' - docker_url = "https://registry.hub.docker.com/v1/repositories/onap/base-sdc-sanity/tags" - docker_answer = """[{"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, - {"layer": "", "name": "v1.0.0"}] - """ - nexus_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0"] - nexus_answer_invalid_tags = ["v1.0.0"] - docker_answer_valid_tags = ["1.3.0", "1.3.1"] - docker_answer_invalid_tags = ["v1.0.0"] - docker_missing_tags = ["1.4.0"] + project = ["onap", "sdc-helm-validator", ""] + + nexus_url = "https://nexus3.onap.org:10002/v2/onap/sdc-helm-validator/tags/list" + nexus_answer = '{"name":"onap/sdc-helm-validator","tags":["v1.0.0","1.3.0", "1.3.1", "1.4.0", "1.4.1","1.6.0", "1.7.0","latest"]}' + nexus_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1", "1.6.0", "1.7.0"] + nexus_answer_invalid_tags = ["v1.0.0", "latest"] + docker_url = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdc-helm-validator/tags" + docker_answer = data_from_file( + os.path.join(str(datafiles), "releasedockerhub_dockertags-sdc-helm-validator-missing1.json") + ) + docker_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.1", "1.6.0", "1.7.0"] + docker_answer_invalid_tags = ["latest", "v1.0.0"] + docker_missing_tags = [ + "1.4.0", + ] self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0 @@ -423,9 +505,9 @@ class TestProjectClass: test_proj = rdh.ProjectClass(project) assert test_proj.org_name == "onap" - assert test_proj.nexus_repo_name == "base/sdc-sanity" - assert test_proj.docker_repo_name == "base-sdc-sanity" - assert test_proj.calc_docker_project_name() == "onap/base-sdc-sanity" + assert test_proj.nexus_repo_name == "sdc-helm-validator" + assert test_proj.docker_repo_name == "sdc-helm-validator" + assert test_proj.calc_docker_project_name() == "onap/sdc-helm-validator" assert len(test_proj.nexus_tags.valid) == len(nexus_answer_valid_tags) assert len(test_proj.docker_tags.valid) == len(docker_answer_valid_tags) @@ -443,7 +525,7 @@ class TestProjectClass: assert self.counter.push == 1 assert self.counter.cleanup == 1 - def test_ProjectClass_socket_timeout(self, responses, mocker): + def test_ProjectClass_socket_timeout(self, responses, datafiles, mocker): """Test ProjectClass""" mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_pull", side_effect=self.mocked_docker_pull) mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_tag", side_effect=self.mocked_docker_tag) @@ -452,19 +534,20 @@ class TestProjectClass: "lftools.nexus.release_docker_hub.ProjectClass._docker_cleanup", side_effect=self.mocked_docker_cleanup ) - project = ["onap", "base/sdc-sanity", ""] - nexus_url = "https://nexus3.onap.org:10002/v2/onap/base/sdc-sanity/tags/list" - nexus_answer = '{"name":"onap/base_sdc-sanity","tags":["1.3.0","1.3.1","1.4.0","v1.0.0"]}' - docker_url = "https://registry.hub.docker.com/v1/repositories/onap/base-sdc-sanity/tags" - docker_answer = """[{"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, - {"layer": "", "name": "v1.0.0"}] - """ - nexus_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0"] - nexus_answer_invalid_tags = ["v1.0.0"] - docker_answer_valid_tags = ["1.3.0", "1.3.1"] - docker_answer_invalid_tags = ["v1.0.0"] - docker_missing_tags = ["1.4.0"] + project = ["onap", "sdc-helm-validator", ""] + nexus_url = "https://nexus3.onap.org:10002/v2/onap/sdc-helm-validator/tags/list" + nexus_answer = '{"name":"onap/sdc-helm-validator","tags":["v1.0.0","1.3.0", "1.3.1", "1.4.0", "1.4.1","1.6.0", "1.7.0","latest"]}' + nexus_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.0", "1.4.1", "1.6.0", "1.7.0"] + nexus_answer_invalid_tags = ["v1.0.0", "latest"] + docker_url = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdc-helm-validator/tags" + docker_answer = data_from_file( + os.path.join(str(datafiles), "releasedockerhub_dockertags-sdc-helm-validator-missing1.json") + ) + docker_answer_valid_tags = ["1.3.0", "1.3.1", "1.4.1", "1.6.0", "1.7.0"] + docker_answer_invalid_tags = ["latest", "v1.0.0"] + docker_missing_tags = [ + "1.4.0", + ] self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0 @@ -475,9 +558,9 @@ class TestProjectClass: test_proj = rdh.ProjectClass(project) assert test_proj.org_name == "onap" - assert test_proj.nexus_repo_name == "base/sdc-sanity" - assert test_proj.docker_repo_name == "base-sdc-sanity" - assert test_proj.calc_docker_project_name() == "onap/base-sdc-sanity" + assert test_proj.nexus_repo_name == "sdc-helm-validator" + assert test_proj.docker_repo_name == "sdc-helm-validator" + assert test_proj.calc_docker_project_name() == "onap/sdc-helm-validator" assert len(test_proj.nexus_tags.valid) == len(nexus_answer_valid_tags) assert len(test_proj.docker_tags.valid) == len(docker_answer_valid_tags) @@ -584,11 +667,14 @@ class TestFetchNexus3Catalog: assert rdh.NexusCatalog[3][1] == "onap/vfc/nfvo/svnfm/nokiav2" +@pytest.mark.datafiles( + os.path.join(FIXTURE_DIR, "nexus"), +) class TestFetchAllTagsAndUpdate: _test_image_long_id = "sha256:3450464d68c9443dedc8bfe3272a23e6441c37f707c42d32fee0ebdbcd319d2c" _test_image_short_id = "sha256:3450464d68" _expected_nexus_image_str = [ - "nexus3.onap.org:10002/onap/base/sdc-sanity:1.4.0", + "nexus3.onap.org:10002/onap/sdc-helm-validator:1.4.0", "nexus3.onap.org:10002/onap/gizmo2:1.3.1", "nexus3.onap.org:10002/onap/gizmo2:1.3.2", ] @@ -657,34 +743,37 @@ class TestFetchAllTagsAndUpdate: if self.counter.cleanup <= self.nbr_exc.cleanup: raise requests.exceptions.ConnectionError("Connection Error") - def initiate_test_fetch(self, responses, mocker, repo=""): + def initiate_test_fetch(self, responses, datafiles, mocker, repo=""): mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_pull", side_effect=self.mocked_docker_pull) mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_tag", side_effect=self.mocked_docker_tag) mocker.patch("lftools.nexus.release_docker_hub.ProjectClass._docker_push", side_effect=self.mocked_docker_push) mocker.patch( "lftools.nexus.release_docker_hub.ProjectClass._docker_cleanup", side_effect=self.mocked_docker_cleanup ) - url = "https://nexus3.onap.org:10002/v2/_catalog" - answer = '{"repositories":["onap/base/sdc-sanity","onap/gizmo","onap/gizmo2"]}' - - nexus_url1 = "https://nexus3.onap.org:10002/v2/onap/base/sdc-sanity/tags/list" - nexus_answer1 = '{"name":"onap/base_sdc-sanity","tags":["1.3.0","1.3.1","1.4.0","v1.0.0"]}' - docker_url1 = "https://registry.hub.docker.com/v1/repositories/onap/base-sdc-sanity/tags" - docker_answer1 = """[{"layer": "", "name": "1.3.0"}, - {"layer": "", "name": "1.3.1"}, - {"layer": "", "name": "v1.0.0"}] - """ + catalog_url = "https://nexus3.onap.org:10002/v2/_catalog" + catalog_answer = '{"repositories":["onap/sdc-helm-validator","onap/gizmo","onap/gizmo2"]}' + + # Missing one tag in docker + nexus_url1 = "https://nexus3.onap.org:10002/v2/onap/sdc-helm-validator/tags/list" + nexus_answer1 = '{"name":"onap/sdc-helm-validator","tags":["v1.0.0","1.3.0", "1.3.1", "1.4.0", "1.4.1","1.6.0", "1.7.0","latest"]}' + docker_url1 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/sdc-helm-validator/tags" + docker_answer1 = data_from_file( + os.path.join(str(datafiles), "releasedockerhub_dockertags-sdc-helm-validator-missing1.json") + ) + + # No missing tags nexus_url2 = "https://nexus3.onap.org:10002/v2/onap/gizmo/tags/list" - nexus_answer2 = '{"name":"onap/gizmo","tags":["1.3.0"]}' - docker_url2 = "https://registry.hub.docker.com/v1/repositories/onap/gizmo/tags" - docker_answer2 = """[{"layer": "", "name": "1.3.0"}] - """ + nexus_answer2 = '{"name":"onap/gizmo","tags":["1.2.0","1.2.1","1.3.0","1.3.1","1.3.2","1.4.0","1.5.2"]}' + docker_url2 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/gizmo/tags" + docker_answer2 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-gizmo.json")) + + # Missing two tags in docker nexus_url3 = "https://nexus3.onap.org:10002/v2/onap/gizmo2/tags/list" - nexus_answer3 = '{"name":"onap/gizmo2","tags":["1.3.0", "1.3.1", "1.3.2"]}' - docker_url3 = "https://registry.hub.docker.com/v1/repositories/onap/gizmo2/tags" - docker_answer3 = """[{"layer": "", "name": "1.3.0"}] - """ - responses.add(responses.GET, url, body=answer, status=200) + nexus_answer3 = '{"name":"onap/gizmo2","tags":["1.2.1","1.3.1","1.3.2"]}' + docker_url3 = "https://registry.hub.docker.com/v2/namespaces/onap/repositories/gizmo2/tags" + docker_answer3 = data_from_file(os.path.join(str(datafiles), "releasedockerhub_dockertags-gizmo2.json")) + + responses.add(responses.GET, catalog_url, body=catalog_answer, status=200) rdh.NexusCatalog = [] rdh.projects = [] @@ -709,20 +798,20 @@ class TestFetchAllTagsAndUpdate: rdh.projects = [] self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0 - def test_fetch_all_tags(self, responses, mocker): - self.initiate_test_fetch(responses, mocker) + def test_fetch_all_tags(self, responses, datafiles, mocker): + self.initiate_test_fetch(responses, datafiles, mocker) rdh.initialize("onap") rdh.get_nexus3_catalog("onap") rdh.fetch_all_tags() assert len(rdh.NexusCatalog) == 3 assert len(rdh.projects) == 3 - assert len(rdh.projects[0].tags_2_copy.valid) == 1 - assert len(rdh.projects[1].tags_2_copy.valid) == 0 - assert len(rdh.projects[2].tags_2_copy.valid) == 2 + assert len(rdh.projects[0].tags_2_copy.valid) == 0 + assert len(rdh.projects[1].tags_2_copy.valid) == 2 + assert len(rdh.projects[2].tags_2_copy.valid) == 1 - assert rdh.projects[0].tags_2_copy.valid[0] == "1.4.0" - assert rdh.projects[2].tags_2_copy.valid[0] == "1.3.1" - assert rdh.projects[2].tags_2_copy.valid[1] == "1.3.2" + assert rdh.projects[1].tags_2_copy.valid[0] == "1.3.1" + assert rdh.projects[1].tags_2_copy.valid[1] == "1.3.2" + assert rdh.projects[2].tags_2_copy.valid[0] == "1.4.0" def test_fetch_from_bogus_orgs(self, responses, mocker): self.initiate_bogus_org_test_fetch(responses, "bogus_org321") @@ -731,8 +820,8 @@ class TestFetchAllTagsAndUpdate: assert len(rdh.NexusCatalog) == 0 assert len(rdh.projects) == 0 - def test_copy(self, responses, mocker): - self.initiate_test_fetch(responses, mocker) + def test_copy(self, responses, datafiles, mocker): + self.initiate_test_fetch(responses, datafiles, mocker) rdh.initialize("onap") rdh.get_nexus3_catalog("onap") rdh.fetch_all_tags() @@ -742,33 +831,33 @@ class TestFetchAllTagsAndUpdate: assert self.counter.push == 3 assert self.counter.cleanup == 3 - def test_start_no_copy(self, responses, mocker): - self.initiate_test_fetch(responses, mocker) + def test_start_no_copy(self, responses, datafiles, mocker): + self.initiate_test_fetch(responses, datafiles, mocker) rdh.start_point("onap", "", False, False) assert self.counter.pull == 0 assert self.counter.tag == 0 assert self.counter.push == 0 assert self.counter.cleanup == 0 - def test_start_copy(self, responses, mocker): - self.initiate_test_fetch(responses, mocker) + def test_start_copy(self, responses, datafiles, mocker): + self.initiate_test_fetch(responses, datafiles, mocker) rdh.start_point("onap", "", False, False, False, True) assert len(rdh.NexusCatalog) == 3 assert len(rdh.projects) == 3 - assert len(rdh.projects[0].tags_2_copy.valid) == 1 - assert len(rdh.projects[1].tags_2_copy.valid) == 0 - assert len(rdh.projects[2].tags_2_copy.valid) == 2 - assert rdh.projects[0].tags_2_copy.valid[0] == "1.4.0" - assert rdh.projects[2].tags_2_copy.valid[0] == "1.3.1" - assert rdh.projects[2].tags_2_copy.valid[1] == "1.3.2" + assert len(rdh.projects[0].tags_2_copy.valid) == 0 + assert len(rdh.projects[1].tags_2_copy.valid) == 2 + assert len(rdh.projects[2].tags_2_copy.valid) == 1 + assert rdh.projects[1].tags_2_copy.valid[0] == "1.3.1" + assert rdh.projects[1].tags_2_copy.valid[1] == "1.3.2" + assert rdh.projects[2].tags_2_copy.valid[0] == "1.4.0" assert self.counter.pull == 3 assert self.counter.tag == 3 assert self.counter.push == 3 assert self.counter.cleanup == 3 - def test_start_copy_repo(self, responses, mocker): - self.initiate_test_fetch(responses, mocker, "sanity") - rdh.start_point("onap", "sanity", False, False, False, True) + def test_start_copy_repo(self, responses, datafiles, mocker): + self.initiate_test_fetch(responses, datafiles, mocker, "sanity") + rdh.start_point("onap", "validator", False, False, False, True) assert len(rdh.NexusCatalog) == 1 assert len(rdh.projects) == 1 assert len(rdh.projects[0].tags_2_copy.valid) == 1 @@ -783,3 +872,14 @@ class TestFetchAllTagsAndUpdate: rdh.start_point("bogus_org321") assert len(rdh.NexusCatalog) == 0 assert len(rdh.projects) == 0 + + +def test_calculate_docker_project_name(): + project = ["onap", "this/is/a-test_project", ""] + rdh.initialize("onap") + test_proj = rdh.ProjectClass(project) + + assert test_proj.org_name == "onap" + assert test_proj.nexus_repo_name == "this/is/a-test_project" + assert test_proj.docker_repo_name == "this-is-a-test_project" + assert test_proj.calc_docker_project_name() == "onap/this-is-a-test_project"