action-docker-layer-caching icon indicating copy to clipboard operation
action-docker-layer-caching copied to clipboard

Support saving images which are identified by SHA rather than tag

Open ZimbiX opened this issue 3 years ago • 9 comments

Hopefully resolves https://github.com/satackey/action-docker-layer-caching/issues/17 and https://github.com/satackey/action-docker-layer-caching/issues/49.

Images can be pulled by SHA, but these don't get tagged, e.g.:

ruby:2.7.2-slim-buster@sha256:b9eebc5a6956f1def4698fac0930e7a1398a50c4198313fe87af0402cab8d149

We can't then use the repo plus non-existent tag to identify it in the call to docker save. Instead, we can use the image ID, e.g.:

docker save redis:3.0 | tar xf - -C output1
docker save c44fa74ead88 | tar xf - -C output2

I'm fetching these details via:

$ docker image ls --format {{.Repository}}:{{.Tag}}:{{.ID}} --filter dangling=false
ruby:2.4:f172588bbb0b
ruby:<none>:ad10dfbc638b
...

This project badly needs some tests. In order to test this locally, I had to do so rather hackily.

I haven't tested out restoring yet. Putting this up here to share my progress.

ZimbiX avatar Apr 26 '21 18:04 ZimbiX

It would be nice if we can pass those sha to the cache action to pick what we want to cache no?

MostefaKamalLala avatar Jun 04 '21 04:06 MostefaKamalLala

@MostefaKamalLala That sounds like a separate feature - there's an issue for it already, https://github.com/satackey/action-docker-layer-caching/issues/121, as you've discovered.

ZimbiX avatar Jun 04 '21 05:06 ZimbiX

What's the status on this? @ZimbiX @satackey

memark avatar Aug 25 '21 09:08 memark

@memark I hadn't actually worked out how to use my fork, and I haven't needed to come back to this since. I was awaiting thoughts from @satackey here. If you figure it out, let me know.

ZimbiX avatar Aug 25 '21 11:08 ZimbiX

I worked out how to use it the other day - the secret was to enable GitHub Actions on my fork, so it could automatically produce a *-release branch with the TypeScript compiled. I could then use the below (I branched again to try things before I realised that, hence the different name):

uses: ZimbiX/action-docker-layer-caching@fix-error-cannot-use-import-statement-outside-a-module-release

Example build

ZimbiX avatar Nov 11 '21 09:11 ZimbiX

@satackey This is confirmed ready to review and merge

ZimbiX avatar Nov 11 '21 09:11 ZimbiX

@satackey @ZimbiX What's the status of this?

ezequielgarcia avatar Jan 09 '22 10:01 ezequielgarcia

@ezequielgarcia We're still waiting for @satackey to review. In the meantime, you can use my fork with the line above =)

ZimbiX avatar Jan 09 '22 12:01 ZimbiX

@satackey Are you still planning on maintaining this project? :pray:

ZimbiX avatar Mar 31 '22 02:03 ZimbiX