Skip to content
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

Git remote context should respect system git config #2655

Open
rcwbr opened this issue Aug 13, 2024 · 0 comments
Open

Git remote context should respect system git config #2655

rcwbr opened this issue Aug 13, 2024 · 0 comments
Labels
kind/enhancement New feature or request status/triage

Comments

@rcwbr
Copy link

rcwbr commented Aug 13, 2024

Description

This is somewhere between a bug, feature request, and just discussion... in short, it seems intuitive that a git repo remote context for build/bake should respect any Git configuration present in the context of the command, but it does not.

"Bug," sort of:

I'm specifically thinking about a url.insteadOf rule in ~/.gitconfig, such as to remap SSH Git URLs to equivalent HTTPS+auth URLs (see a gist with specifics of how this would work, e.g. for CI). It seems ideal to leverage GIT_AUTH_TOKEN/BUILDX_BAKE_GIT_AUTH_TOKEN in such cases, but the missing piece is support for handling the same remote context URL in SSH-authenticated environments and HTTP-authenticated environments, by those environments' configurations.

I'm using this as a workaround (again see gist for more), but feel a bit gross about it: sed -i "s|[email protected]:|https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/|" [bake file]

"Feature request," sort of:

While the case I outlined above is focused on the url.insteadOf case, I could imagine others where the host git config would be useful (maybe core.sshCommand). The ideal feature here IMO would leverage any present git config as any standalone git client would whenever resolving a git repo remote build context.

Perhaps it would just be necessary to leverage git_cli as part of relevant functions like ParseGitRef?

"Discussion," sort of:

On the other hand, the dir URL fragment syntax means that git remote build contexts aren't exactly like normal git URLs, so maybe it would add confusion to even leverage git config rules? Cases like this could be easier, but other, stranger unexpected behaviors could arise. Instead, maybe just a bit of docs clarification should specify how these URLs are handled (i.e. not quite like equivalent git clones), to save folks from going down this rabbit hole?

@rcwbr rcwbr added kind/enhancement New feature or request status/triage labels Aug 13, 2024
@thompson-shaun thompson-shaun added the kind/bug Something isn't working label Aug 13, 2024
@tonistiigi tonistiigi removed the kind/bug Something isn't working label Aug 16, 2024
@thompson-shaun thompson-shaun added kind/bug Something isn't working kind/enhancement New feature or request and removed kind/enhancement New feature or request kind/bug Something isn't working labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request status/triage
Projects
None yet
Development

No branches or pull requests

3 participants