Skip to content

engine: support for user-specified Git URL rewrite rules #7787

Closed

Description

@sipsma

Git has support for rewriting URLs, which can be useful for use cases like:

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:

  1. 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.
  2. 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)

Related Discord thread: https://discord.com/channels/707636530424053791/1255946935140089936/1255946935140089936

  • Use case around different URLs depending on the client

Activity

  1. added this to the next milestone on Jun 29, 2024
  2. marcosnils commented on Jun 29, 2024

    @marcosnils
    Contributor

    I think we'll also have to make some minor changes to our git client fork since we're currently disabling any abilities to load configs https://github.com/dagger/dagger/blob/main/engine/sources/gitdns/cli.go#L104-L112

  3. samalba commented on Jul 12, 2024

    @samalba
    Contributor

    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.

  4. sipsma commented on Jul 12, 2024

    @sipsma
    ContributorAuthor

    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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions