You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
engine: support for user-specified Git URL rewrite rules #7787
Enabling a portable URL to be used that is switched based on execution environment (i.e. URL may vary from one machine to another in complex corp environments)
Dagger doesn't support this right now though. The most conceptually similar thing we support are container image registry URL aliases, which can be specified in the engine's config file, but that's very specific to pulling images obviously.
We can add support for this though:
The engine can automatically check for these setting's in the user's .gitconfig file and use them. We wouldn't even need a new session attachable I think; our filesync plumbing supports just reading individual files as byte streams that never end up in cache or anything.
We could add support to the engine config file too if desired, though given that currently requires custom provisioning an engine I suspect it's more often not as convenient as loading this from the client caller (just a hunch, could be wrong)
Loading the user's `.gitconfig` would break the pipeline's portability (it would behave differently based on contextual data). Instead, I'd support it at the API level with the ability to change how the git client behaves for the whole pipeline.
Loading the user's .gitconfig would break the pipeline's portability (it would behave differently based on contextual data). Instead, I'd support it at the API level with the ability to change how the git client behaves for the whole pipeline.
I agree that's a worthy consideration, but would argue that's actually what we want here. There's pre-existing contextual data we use from clients in the form of local dirs, local docker auth config, local services/unix-socks, etc.
The super important part of handling this "client context" is that we cache based on the actual underlying operation after resolving any client-specific details/configs/files/etc. So in the case of git rewriting rules, we would cache the operation based on what the URL ends up being re-written to as opposed to the value in the pipeline code.
We do similar things for other existing contextual data; e.g. for local dirs the cache is keyed by a content digest of what's loaded, as opposed to caching just based on the path (which is obviously not portable)
Provided we do that it is actually portable.
The advantage of this approach is that it prevents all these client-specific details from leaking into users code (i.e. each client on each machine would need to submit queries with different URLs and thus end up somehow changing the code that creates the queries, etc.).
This gets extra important in the case of re-usable modules, since it's a huge pain to have to fork a module and update it's code just to adjust little client-specific details like this
Activity
marcosnils commentedon Jun 29, 2024
I think we'll also have to make some minor changes to our
gitclient fork since we're currently disabling any abilities to load configs https://github.com/dagger/dagger/blob/main/engine/sources/gitdns/cli.go#L104-L112samalba commentedon Jul 12, 2024
Loading the user's `.gitconfig` would break the pipeline's portability (it would behave differently based on contextual data). Instead, I'd support it at the API level with the ability to change how the git client behaves for the whole pipeline.
sipsma commentedon Jul 12, 2024
I agree that's a worthy consideration, but would argue that's actually what we want here. There's pre-existing contextual data we use from clients in the form of local dirs, local docker auth config, local services/unix-socks, etc.
The super important part of handling this "client context" is that we cache based on the actual underlying operation after resolving any client-specific details/configs/files/etc. So in the case of git rewriting rules, we would cache the operation based on what the URL ends up being re-written to as opposed to the value in the pipeline code.
Provided we do that it is actually portable.
The advantage of this approach is that it prevents all these client-specific details from leaking into users code (i.e. each client on each machine would need to submit queries with different URLs and thus end up somehow changing the code that creates the queries, etc.).