pack icon indicating copy to clipboard operation
pack copied to clipboard

Attempt to delete previous cache image fails

Open genevieve opened this issue 3 years ago • 4 comments

Summary

Everything seems to be working correctly building a simple go app with --publish and --cache-image for an existing image in a remote registry but there's a log at the end of rebuilds that says it fails to delete the previous cache image. Not sure what the cause is.

Reproduction

Steps
  1. Run pack build app:tag --publish --cache-image app:tag
  2. Run it again
Current behavior
2021/04/09 17:19:48.230688 Reusing cache layer 'paketo-buildpacks/go-dist:go'
Layer 'paketo-buildpacks/go-dist:go' SHA: sha256:78473bd74cb16be010b30de44123937411ec5345e6487592948af576322e843f
2021/04/09 17:19:49.566066 Adding cache layer 'paketo-buildpacks/go-build:gocache'
Layer 'paketo-buildpacks/go-build:gocache' SHA: sha256:dff9783e8c4c0218288ea0707c752f8cb6f2853da6bf5a24f9b1f1dbec9b100e
2021/04/09 17:21:54.751842 Unable to delete previous cache image: DELETE https://index.docker.io/v2/doxgen/leftovers/manifests/sha256:c2b65f6cca8e70d8ffe27840e5d2ad190a9021933acc2d99df8b84c6d5da9ef0: UNSUPPORTED: The operation is unsupported.2021/04/09 17:21:56.013978 Successfully built image doxgen/leftovers:latest
Expected behavior

No error cleaning up a previous cache image.

Environment

pack info
Pack:
  Version:  0.18.0+git-e00ee4a.build-2328
  OS/Arch:  darwin/amd64

Default Lifecycle Version:  0.10.2

Supported Platform APIs:  0.3, 0.4
docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.5.0)

Server:
 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 14
 Server Version: 20.10.5

genevieve avatar Apr 10 '21 00:04 genevieve

@genevieve not all registries actually allow you to delete images. You could confirm with curl or crane delete app:image whether your registry supports this.

ekcasey avatar Apr 13 '21 14:04 ekcasey

Which crane are you referring to ?

I tried with a different image to a different registry and on the first run it failed but the second it succeeded. The first run is the first time the image with that tag was published so I guess it automatically tries to delete the previous cached image even if there was none for that image when it initially checks at boot?

2021/04/13 09:24:13.159727 Unable to delete previous cache image: DELETE https://registry/v2/dir/app/manifests/sha256:03cbce912ef1a8a658f73c660ab9c539d67188622f00b15c4f15b89b884f0e10: MANIFEST_UNKNOWN: manifest unknown; [map[Name:dir/app] map[Revision:sha256:03cbce912ef1a8a658f73c660ab9c539d67188622f00b15c4f15b89b884f0e10]]

genevieve avatar Apr 13 '21 16:04 genevieve

I believe this is the crane tool referred to above.

dwillist avatar Apr 15 '21 17:04 dwillist

Unfortunately AFAIK there is no good way to determine if a registry supports the DELETE operation unless you attempt it. Though we could make it a less jarring user experience.

dwillist avatar Apr 15 '21 17:04 dwillist

Fixed by https://github.com/buildpacks/lifecycle/pull/1136

natalieparellano avatar Aug 18 '23 18:08 natalieparellano