From 9c00693b45397cea7ea65b399f09fbd5a60a1860 Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Thu, 6 Apr 2023 14:19:20 +0000 Subject: [PATCH] patch(release_charm.yaml): Use `removeprefix()` instead of `lstrip()` (#33) .lstrip removes all characters from the argument string without looking at order Failed release: https://github.com/canonical/mysql-k8s-operator/actions/runs/4628426136/jobs/8189111937 Release failed since `sha256:65749c3ab318a6b2e3c8a8a6f731d15acaecf25669917181f5d24e01ce0cae95` was converted to `749c3ab318a6b2e3c8a8a6f731d15acaecf25669917181f5d24e01ce0cae95` instead of `65749c3ab318a6b2e3c8a8a6f731d15acaecf25669917181f5d24e01ce0cae95` --- release_charm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_charm.py b/release_charm.py index 54c9b3fe..abcdfdb6 100644 --- a/release_charm.py +++ b/release_charm.py @@ -63,7 +63,7 @@ def run(command_: list): logging.info(f"Downloading OCI image: {image_name}") run(["docker", "pull", image_name]) image_id = run(["docker", "image", "inspect", image_name, "--format", "'{{.Id}}'"]) - image_id = image_id.rstrip("\n").strip("'").lstrip("sha256:") + image_id = image_id.rstrip("\n").strip("'").removeprefix("sha256:") assert "\n" not in image_id, f"Multiple local images found for {image_name}" logging.info(f"Uploading charm resource: {resource_name}") output = run(