-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise error (instead of warn) when uncommitted git changes are detected #1409
base: main
Are you sure you want to change the base?
Raise error (instead of warn) when uncommitted git changes are detected #1409
Conversation
Changes the default behavior from printing a warning to printing an error message and exiting. New CLI introduced to suppress the error and proceed with previously-default behavior.
02916ae
to
9fadae3
Compare
Not 100% sold on the flag name, wondering if |
I like the idea, a couple of thoughts:
It looks like there's actually a builder helper method to help detect if it's building from a git clone or just a context, it'd be great to utilize this as a way to raise. What you're ultimately trying to raise for is specifically when it's using a git clone, there shouldn't be a need to raise when using the local build context. kamal/lib/kamal/configuration/builder.rb Line 126 in 6f29d4e
As far as the flag name, something with @djmb mentioned he'd be out this week, but it'd be good to get his thoughts on this since it'll change some of the kamal ergonomics. |
Kamal already uses this helper method to determine if to display the warning (and now the error), my check appears immediately after it: https://github.com/basecamp/kamal/pull/1409/files#diff-937ec1fc90a4c631a3f6f4095230378aa62fef153c3e1de477cfc2005dc2a7f9L22
I'll think on that some. At the moment, I think |
Hey @djmb, just wanted to touch base and see if you had any initial feedback? We've been using this version of Kamal the last few weeks, and it's already saved us once (by spitting out an error and exiting), when we overlooked committing a local change. |
After hanging around in the Discord for a few months, I've noticed that many beginners to Kamal experience "unexpected behavior" when it comes to making changes locally and then deploying, expecting that Kamal would've deployed their latest uncommitted changes.
Kamal would print out a warning message in yellow, but this can get lost in the sea of yellow messages and verbose output that Kamal prints out. Since the primary intended usage of Kamal is for you to first commit your changes before pushing/deploying, I believe it would be better to have the warning about ignoring uncommitted changes become an error, by default, and exit. If you purposefully want to have ignored, uncommitted local changes while pushing/deploying, you can suppress the error via
--skip-uncommitted-changes-check
, which results in Kamal printing out a warning in yellow but still proceeding (like it did by default prior to this change).kamal build push
error, by defaultkamal build push
skip error, via--skip-uncommitted-changes-check
kamal deploy
error, by defaultkamal deploy
skip error, via--skip-uncommitted-changes-check