Fix GitLab clone URLs and authentication in pr_diff Dockerfiles - #94
Merged
adithya-s-k merged 1 commit intoSep 15, 2026
Merged
adithya-s-k merged 1 commit into
adithya-s-k merged 1 commit into
Conversation
KNambiarDJsc
left a comment
Contributor
There was a problem hiding this comment.
I reviewed and tested 719238d:
- CI-equivalent run on Linux: ruff is clean, and the full suite passes on py3.12 and py3.14 (730 passed).
- Generated Dockerfiles,
mainvs this PR:--repo pallets/click: the only change is the quoted token expansion,x-access-token:"${GITHUB_TOKEN}"@github.com/.... The shell treats it the same, so GitHub tasks are unaffected.--repo https://gitlab.com/python-devs/importlib_resources:mainemittedARG GITHUB_TOKENand clonedhttps://github.com/python-devs/importlib_resources.git. With this PR it emitsARG GITLAB_TOKEN, clones throughoauth2:"${GITLAB_TOKEN}"@gitlab.com/..., and uses the correct clean URL.
- The quoting tests are thorough. They run the real
RUNbody through/bin/shwith a fakegit, including a token containing spaces,*,$HOMEand$(false).
LGTM. Two non-blocking follow-ups:
docs/reference/AUTH.mdis still GitHub-only. Its "Private repos at task build time" section says the Dockerfile declaresARG GITHUB_TOKEN=and clones throughx-access-token:<token>@github.com/..., so a consumer following it for a GitLab task would pass the wrong build arg. MentioningGITLAB_TOKENandoauth2:there would match the updatedpr_diff.md.- Windows test runs. The 6
test_clone_shell_uses_correct_token_and_scrubs_origincases fail on Windows withFileNotFoundError, because there's no/bin/sh. CI is Linux-only, so there's no CI impact. Addingpytest.mark.skipif(not Path("/bin/sh").exists(), reason="needs a POSIX shell")would keep the suite usable there; #108 tracks the other Windows issues.
adithya-s-k
approved these changes
Sep 15, 2026
Collaborator
|
thanks @abhinavgautam01, merged! appreciate the GitLab clone and auth fixes, especially the coverage around credentials. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #93
Summary
GitLab merge requests were mined through the correct provider, but their emitted
pr_diffDockerfiles cloned a hardcoded GitHub URL. This could fail the environment build or target a different repository.Build clone URLs from the source repository URL, preserving the host and full path. Normalize supported SSH-style inputs to HTTPS and select
GITHUB_TOKENorGITLAB_TOKENusing the existing authentication helper.Quote token expansion, remove credentials supplied in source URLs and retain the clean origin reset after cloning. Update documentation to describe provider-specific authentication.
Validation
Add 15 regression cases covering GitHub compatibility, GitLab URLs, nested paths, SSH-style inputs, credential stripping and public/authenticated clone commands.
The shell tests execute the generated clone commands with a fake Git executable and dummy tokens, checking argument handling and origin cleanup without network access.
Scope
Private GitLab MR diff fetching remains unsupported under #65. This change fixes emitted clone URLs and build-time authentication; it does not establish end-to-end private GitLab mining support.