Repository navigation
feat(engine): add support for fetching git config - #9323
Conversation
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
I am working through changing the SDK field from being a string to a struct to support the 2nd part of this PR (to pass along goprivate env variable) |
|
I have this working end to end. and currently cleaning up the changes (in a different branch, will pull them here) and working through test failures. The complete fix for this also needs #9454 which adds the ability to set environment variables in codegen/runtime container from dagger.json. the idea is that with this PR, we will pull the selective gitconfig keys from user's configuration and add them to the codegen/runtime container automatically. we are doing selective gitconfig because we don't want to pull all the git-config key/values from user system as they may or may not work on the engine (e.g. a config pointing to a file on the local file system for gitignore). Also we don't want to be in a position where we allowed everything, ran into a problem with some keys but can't revert back because of backward compatibility problems. |
2d7f145 to
80a0a2c
Compare
e9a06b2 to
ff9e91b
Compare
f3cd6f6 to
82ea4ed
Compare
b922049 to
49386ab
Compare
|
Hi @jedevc, this PR is ready for final set of review/merge. When you get chance, could you please look into this. thank you. |
ec5decf to
959f8d1
Compare
| return nil, err | ||
| } | ||
|
|
||
| for _, entry := range gitconfig { |
There was a problem hiding this comment.
Is there a way to avoid this being in lots of little WithExecs? I think I mentioned this before in #9323 (comment).
There was a problem hiding this comment.
I did tried it. It seems like not... (unless we take complete git config as is). once we fetch config using git config -l, we cannot translate it back to a working gitconfig file unless we call git config on those retrieved values again.
There was a problem hiding this comment.
🤔 is it not just as simple as appending to the gitconfig file manually? Or is that just too fundamentally complex?
The other option would be to combine all of these by passing them to a sh and joining them with &&.
There was a problem hiding this comment.
Potentially https://github.com/go-git/go-git/blob/main/plumbing/format/config/common.go might also be useful here?
There was a problem hiding this comment.
yep, this seems useful to me.
There was a problem hiding this comment.
i tried this one. it seems it does not support merging git configs (e.g. system level vs user level vs repo level).
although when running git config -l through session attachable, it does not consider repo level config either.
another thing to notice is that we have a safe list of git config keys allowed right now, which is just one, so having withExec is not going to be a problem unless we allow a large number of keys (or remove that check) from here.
There was a problem hiding this comment.
Ah, yes, I'd forgotten we only allow the url transformation.
jedevc
left a comment
There was a problem hiding this comment.
Couple comments, otherwise LGTM 🎉
Signed-off-by: Rajat Jindal <[email protected]>
Signed-off-by: Rajat Jindal <[email protected]>
Signed-off-by: Rajat Jindal <[email protected]>
Signed-off-by: Rajat Jindal <[email protected]>
9261f73 to
06627e2
Compare
Signed-off-by: Rajat Jindal <[email protected]>
06627e2 to
8fc747e
Compare
Signed-off-by: Justin Chadwell <[email protected]>
|
Okay, @rajatjindal merging this now. Ideally we'd also have some docs for this as well - not sure exactly where these should go, maybe into https://docs.dagger.io/api/remote-modules? It's related to the concept of remote modules, but it's about private deps. Perhaps @grouville and @vikram-dagger can advise here. |
|
This PR cover a few changes:
Add support to fetch gitconfig from user's host system.
Add support for SDK Config in the engine.
Add support for private dependencies in golang sdk
Add support for custom config in typescript sdk
|
* chore(engine): rename GitCredential attachable to Git Signed-off-by: Rajat Jindal <[email protected]> * feat(engine): support fetching gitconfig from host system Signed-off-by: Rajat Jindal <[email protected]> * feat(sdk): add support for sdk specific config Signed-off-by: Rajat Jindal <[email protected]> * ensure gitconfig, and ssh_auth_sock works Signed-off-by: Rajat Jindal <[email protected]> * address review comments Signed-off-by: Rajat Jindal <[email protected]> * chore: remove outdated module_test.go TODO Signed-off-by: Justin Chadwell <[email protected]> --------- Signed-off-by: Rajat Jindal <[email protected]> Signed-off-by: Justin Chadwell <[email protected]> Co-authored-by: Justin Chadwell <[email protected]> Signed-off-by: kpenfound <[email protected]>
Fixes #8766, #9178 by implementing #7787.