From 962cc127f07ef1980a49cd0355df3ad78a48bc82 Mon Sep 17 00:00:00 2001 From: bensteinberg Date: Thu, 10 Aug 2023 14:04:58 -0400 Subject: [PATCH] Check for absence of repository --- update_tags.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/update_tags.py b/update_tags.py index bd3c39e..8d5ebb5 100644 --- a/update_tags.py +++ b/update_tags.py @@ -82,7 +82,12 @@ def remote_tag_exists(tag): # can we assume https? r = requests.get(f'https://{host}/v2/{repository}/tags/list') - return version in r.json()['tags'] + if r.status_code == 404: + # this repository doesn't exist yet; there may be other conditions + # we should check here + return False + else: + return version in r.json()['tags'] def main(docker_compose_path='docker-compose.yml', action='load'):