-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implement defining remote git dependencies in the skaffold configuration. #5361
Implement defining remote git dependencies in the skaffold configuration. #5361
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5361 +/- ##
==========================================
- Coverage 71.58% 71.55% -0.04%
==========================================
Files 394 395 +1
Lines 14305 14409 +104
==========================================
+ Hits 10240 10310 +70
- Misses 3309 3333 +24
- Partials 756 766 +10
Continue to review full report at Codecov.
|
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.
Code and testing is looking really good. Have some comments on the example readme
integration/examples/remote-multi-config-microservices/README.md
Outdated
Show resolved
Hide resolved
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.
LGTM, thanks for fixing the example :) I won't merge yet as I'm not sure if we want to get another pair of eyes on this since it's a larger PR
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.
Every execution of a remote module resets the cached repo to the referenced ref
let's say I have one git module in my project. I run skaffold dev
, and make a bunch of local changes to the cloned code which I'm seeing be redeployed to my cluster. I take a break by hitting ctrl+c
, and then later start up a new skaffold dev
session - all of the changes I made in my previous session are overwritten because my local cache got reset to the remote ref!
I think this should be configurable. it probably makes sense for this to be reset in some cases, but in others users might be experimenting with some changes to a dependency that they later want to commit, or at least persist. the default behavior here might even be to NOT reset the local cache to the remote ref.
To decide on this behavior I think we need to decide what role a remote dependency serves. IMO it's a central store of Skaffold managed repositories. There can be multiple projects sharing the same repository akin to how a go module gets downloaded and shared by projects using them. IMO if I intend to make modification to a code and keep them I'd rather not have them in that managed store and clone them explicitly myself. If I selectively allow reset, then I can't have multiple skaffold projects sharing this cache. WDYT? |
Co-authored-by: Nick Kubala <nkubala@users.noreply.github.com>
cc. @tejal29, @briandealwis, @marlon-gamez what do you guys think about this? |
one of my thoughts around this was that this feature would be a good way to "trial" out a service in your application, since it's really easy to just plug-and-play any service with a skaffold.yaml. in that case we might want to allow users to make some local modifications without stomping on their changes - but the more i think about this, the more i think this is an uncommon use case. my opinion is that we should give the ability to users to turn this auto-syncing off with a config field, but we should definitely default to resetting their local changes on every run. you make a great point that these local clones could be shared across projects, in which case local changes could cause unexpected behavior. |
I'm in agreement with what Gaurav is saying, and I also agree with Nick that this should be configurable as well. |
configNameToFile map[string]string // configName -> file path | ||
cachedRepos map[string]interface{} // git repo -> cache path or error | ||
} | ||
|
||
func getAllConfigs(opts config.SkaffoldOptions) ([]*latest.SkaffoldConfig, error) { |
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.
Would it make sense to have these functions be methods on record
?
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.
I don't think there's any difference either way.
I agree with @gsquared94: the local clones in But @nkubala is right too: people need the ability make tweaks and overrides (viz So I'd advocate changing the strict behaviour to logging warnings on finding unsaved work or unpublished commits. |
Fixes: #5302
Description
Implements defining remote git repositories as skaffold config dependencies.
The environment variable
SKAFFOLD_REMOTE_CACHE_DIR
or flag--remote-cache-dir
specifies the download location for all remote repos. If undefined then it defaults to~/.skaffold/repos
.The repo root directory name is a hash of the repo
uri
and thebranch/ref
.Every execution of a remote module resets the cached repo to the referenced ref. The default ref is
master
. Ifmaster
is not defined then it defaults tomain
.The remote config gets treated like a local config after substituting the path with the actual path in the cache directory.
Look at the new
remote-multi-config-microservices
example