basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
9.38k stars 357 forks source link

kamal deploy with --skip-push tries a local docker registry login #814

Closed DazWorrall closed 4 weeks ago

DazWorrall commented 1 month ago

Hey 👋 We're experimenting with Kamal at Shopify and it's allowed us to go from zero to one pretty quickly for a particular project, so thanks for that. For the most part we've been able to adopt Kamal pretty cleanly but there's one issue in particular I wanted to flag.

We have an existing build infra for container images so we can skip the build and push at kamal deploy time, and do so with the --skip-push flag. Because we build separately our deploy system does have access to a docker daemon, however Kamal will try to log into the registry locally even if no build and push is required:

https://github.com/basecamp/kamal/blob/88947b6a7ba17071940bf859f213a607065300cb/lib/kamal/cli/registry.rb#L3-L5

(#login is called here before the --skip-push flag is checked.)

We've worked around this by stubbing out the docker binary on the deploy system and with that we're able to deploy successfully, but it would be nice to do better than hack around the requirement like this. If --skip-push skipped the local login that would be fine - and if the intention of the local login is to check the image could be pushed before trying to build it, then that aligns with the intent of the flag - alternatively a separate flag could be added if you think that's warranted. Or something else I haven't thought of.

I'm happy to spend some time on a PR if you have a preferred fix in mind.

djmb commented 1 month ago

Thanks for raising this @DazWorrall. There's no need for the local login when using skip push, so we can remove it 👍

DazWorrall commented 4 weeks ago

Thanks @djmb!