-
Notifications
You must be signed in to change notification settings - Fork 167
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
chore(devx): make tilt crazy fast #1248
Conversation
Signed-off-by: Kent <kent.rancourt@gmail.com>
✅ Deploy Preview for docs-kargo-akuity-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1248 +/- ##
=======================================
Coverage 48.50% 48.50%
=======================================
Files 127 127
Lines 9675 9675
=======================================
Hits 4693 4693
Misses 4823 4823
Partials 159 159 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think you could separate this out this into a different Dockerfile. A technique I've seen and used in the past is to have Dockerfile and Dockerfile.dev to split out the dev related stuff from Dockerfile.
Because now if someone only wants to build a kargo image, then it will unnecessarily build other stuff.
@jessesuen it won't unnecessarily build other stuff. Docker is smart about only building the stages that are required for the final product. Edit: I stand corrected. I could not find the documentation to verify that and a test build is showing me otherwise. Looking into it. Edit 2: Correcting my correction. Buildkit does skip unnecessary layers, and indeed my test builds did. I was misinterpreting my build logs. Here is an example, built using absolute minimum options and no cache as proof:
There is no occurrence of string |
I had a lot of conversations with @rbreeze last week about reasons he typically opts to run Kargo components as native processes instead of a local cluster. It was enlightening and inspired me to fix everything that was slowing Tilt down.
If using Tilt to develop in a local cluster, this PR will make image builds faster overall, achieve sub-second restarts on every component, and the UI component will even be live updated as code changes.
How it works:
Two new stages are added to the Dockerfile. These two new stages are not involved in the official image that is built and published by our release process. They are only for facilitating local development, and the differences between them and the stage that produces the official image are minor.
There is one new stage for the back end and one for the front.
The one for the back end copies a natively/locally built
kargo
binary from the host instead of building thekargo
binary in-container. (This allows the build to take advantage of your local Go installation's own cache -- a benefit that is lost when building in a container.) It also omits the front end.The one for the front end runs vite -- which is how @rbreeze runs the front end locally. It also omits the back end.
The updated
Tiltfile
has some new smarts.When a back end component is restarted, the
kargo
binary is built natively/locally and then the image is rebuilt, targeting the new back end stage that just copies that binary. This achieves sub-second restarts on back end components.For local development only, Tilt serves the front end from a separate component (not the API server.) It's running vite, as previously mentioned. When front end code changes, the changes are instantly synced to the pod running vite. Vite already knows how to apply code changes without restarting. This means the UI is always live updating as changes are made and never requires a restart.
Known issue: SSO will fail locally, but I know how to fix that and will handle it in a follow-up.
Screen.Recording.2023-12-07.at.9.42.03.PM.mov