Skip to content

Commit

Permalink
patch(release_charm.yaml): Use removeprefix() instead of lstrip() (
Browse files Browse the repository at this point in the history
…#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`
  • Loading branch information
carlcsaposs-canonical authored Apr 6, 2023
1 parent c8ee045 commit 9c00693
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion release_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9c00693

Please sign in to comment.