Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/cosalib/container_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ def create_local_container_manifest(repo, tag, images) -> dict:
return json.loads(manifest_info)

Copy link
Member

@aaradhak aaradhak Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need an extra line here? CI test fails as two blank lines are required before every function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


def local_container_manifest_exists(repo, tag):
'''
Delete local manifest list
@param repo str registry repository
@param tag str manifest tag
'''
cmd = ["podman", "manifest", "exists", f"{repo}:{tag}"]
cp = runcmd(cmd, check=False)
# The commands returns 0 (exists), 1 (doesn't exist), 125 (other error)
if cp.returncode == 125:
if cp.stdout:
print(f" STDOUT: {cp.stdout.decode()}")
if cp.stderr:
print(f" STDERR: {cp.stderr.decode()}")
raise Exception("Error encountered when checking if manifest exists")
return cp.returncode == 0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be an extra line here too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


def delete_local_container_manifest(repo, tag):
'''
Delete local manifest list
Expand Down Expand Up @@ -56,6 +74,9 @@ def create_and_push_container_manifest(repo, tags, images, v2s2) -> dict:
@param images list of image specifications (including transport)
@param v2s2 boolean use to force v2s2 format
'''
if local_container_manifest_exists(repo, tags[0]):
# perhaps left over from a previous failed run -> delete
delete_local_container_manifest(repo, tags[0])
manifest_info = create_local_container_manifest(repo, tags[0], images)
push_container_manifest(repo, tags, v2s2)
delete_local_container_manifest(repo, tags[0])
Expand Down
Loading