Skip to content

Commit

Permalink
breaking(release_charm.yaml): Upload OCI resources from GHCR directly (
Browse files Browse the repository at this point in the history
…#198)

charmcraft 2.7.0 contains a fix for multi-arch OCI images issue:
canonical/charmcraft#1685 fix:
canonical/charmcraft#1708

However, it fixes it in a "backwards-compatible" way—if the image is
available locally, it will still upload it incorrectly.

Stop downloading the image locally & always use GHCR so that charmcraft
uploads the image correctly

This will break on charmcraft < 2.7.0
  • Loading branch information
carlcsaposs-canonical authored Jun 19, 2024
1 parent a494fba commit 1540c72
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions python/cli/data_platform_workflows_cli/craft_tools/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ def charm():
for resource_name, resource in resources.items():
if resource["type"] != "oci-image":
continue
image_name = resource["upstream-source"]
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("'").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 All @@ -184,7 +176,7 @@ def charm():
charm_name,
resource_name,
"--image",
image_id,
f'docker://{resource["upstream-source"]}',
]
)
revision: int = json.loads(output)["revision"]
Expand Down

0 comments on commit 1540c72

Please sign in to comment.