Skip to content

Pass username from credential helper - #10613

Merged
jedevc merged 7 commits into
dagger:mainfrom
skycaptain:feature/username-git-credential-helper
Jun 23, 2025
Merged

jedevc merged 7 commits into
dagger:mainfrom
skycaptain:feature/username-git-credential-helper

Conversation

@skycaptain

Copy link
Copy Markdown
Contributor

See #10605 (comment) where this was reported first.

With #10605 we introduced Git.httpAuthUsername; however, during refactoring, the part where the username was passed on from the credential helper was accidentally removed. This PR adds it back.

During testing, I encountered the following error:

failed to resolve git src: failed to resolve git src: select: select: failed to compute cache key for Query.git: assign input "httpAuthUsername" (string) as {Value:x-token-auth Valid:true} (dagql.Optional
com/dagger/dagger/dagql.String]): assign: cannot assign dagql.Optional[github.com/dagger/dagger/dagql.String] to string

I couldn't find any solution other than using dagql.String again. This approach was specifically requested not to be used by @jedevc during review of #10605. Perhaps this was why @grouville used dagql.String in the first place? Thus, I reverted that bit from the previous PR and added the fix on top.

Closes #10612.

@skycaptain
skycaptain requested review from a team as code owners June 19, 2025 00:55
@skycaptain

Copy link
Copy Markdown
Contributor Author

Let me know if there is a proper solution for the string/daqgl.String situation.

@jedevc

jedevc commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

Pushed some commits, with some minor fixups (some related, some not, see commit messages for more detail).

The main bit is untangling the string/dagql.String stuff (looks like the sshKnownHosts part that this was similar to was just wrong in the first place, so fixed that too).

I also made sure we had tests for this, making sure that credentials are properly loaded from the client - we didn't have tests for this really at all (see my comment in #10427 (comment)), so I've added these.

skycaptain and others added 5 commits June 19, 2025 14:07
We weren't doing this before - this could have appeared as a bug later
on.

Signed-off-by: Justin Chadwell <[email protected]>
This was always broken.

Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
@jedevc
jedevc force-pushed the feature/username-git-credential-helper branch from f81f081 to 14c97ed Compare June 19, 2025 13:07
@jedevc
jedevc force-pushed the feature/username-git-credential-helper branch from 14c97ed to da2fadd Compare June 19, 2025 13:21
@jedevc
jedevc requested a review from grouville June 19, 2025 13:21
@jedevc jedevc added this to the v0.18.11 milestone Jun 19, 2025
@skycaptain

Copy link
Copy Markdown
Contributor Author

Pushed some commits, with some minor fixups (some related, some not, see commit messages for more detail).

Many thanks. Looks great! Seems to work from what I can tell, testing locally.

The main bit is untangling the string/dagql.String stuff (looks like the sshKnownHosts part that this was similar to was just wrong in the first place, so fixed that too).

Yes, that sshKnownHosts part really tricked me. Why should that part work and httpAuthUsername following the exact same pattern would not. Good, this issue is now alos fixed

I also made sure we had tests for this, making sure that credentials are properly loaded from the client - we didn't have tests for this really at all (see my comment in #10427 (comment)), so I've added these.

I was just about to push the tests I wrote this morning when I saw your pushes. Yours are much more comprehensive. So thanks for that as well.

@daniel-naegele

Copy link
Copy Markdown

Hey folks I know you are fast and I don't want nag/annoy, but is there an ETA on when this PR is merged? Or is there a way to specify in the install script to use another branch/repo and build from source? This is kinda urgent for me as I am currently writing my bachelors thesis around Dagger as its main tool and need a proper solution to pull other repos in a GitLab environment, SSH Keys and PATs are for me and our GitLab setup not a really viable workaround...

@jedevc

jedevc commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

@daniel-naegele the last activity here was less than 24 hours ago 😁 it's moving, don't worry! It's also in the next release milestone, so we'll it'll be part of our next release sometime next week (exact datetime tbd).

I'm just waiting for @grouville to have a chance to review 😁

@grouville grouville left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you ! I'm not familiar with these dagql views, learning along the way 🙏

I also finally understand the comment you made about testing the loading of credentials for git in a self contained test, very clever 🙏

@jedevc
jedevc merged commit 4997e9a into dagger:main Jun 23, 2025
@skycaptain
skycaptain deleted the feature/username-git-credential-helper branch June 23, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing username from credential helper to Git.httpAuthUsername does not work

4 participants