Closed toph-allen closed 2 years ago
I haven’t found any historical reference to GitLab ever allowing basic password auth in its API, even going back into old issues and StackOverflow posts. I wondered if I was missing some search term. The original implementation was tested against a public repo and followed the Bitbucket implementation (Bitbucket does use username and password).
I think it's likely that GitLab has never supported basic auth with username and password, and that this feature has just never been exercised properly due to renv
's availability and Connect not supporting restoring packages from private sources.
@aronatkins , do you think it makes sense to remove the GITLAB_USERNAME
and GITLAB_PASSWORD
“capability” entirely from packrat? I think that leaving it may only serve to send users on a wild goose chase.
@aronatkins I removed GITLAB_USERNAME
and GITLAB_PASSWORD
support in the latest commit.
renv
already existed and supported GitLab.Removing it from Packrat will avoid sending users down a dead end.
CI is failing on oldrel-1
— it looks like network errors in apt-get
or something like that.
Intent
Fix source downloads from private GitLab repositories by preferentially using
GITLAB_PAT
for authentication.Fixes #673
Approach
The GitLab downloader now checks for a
GITLAB_PAT
. If that exists, instead of creating the username/password auth, it addsPrivate-Token
to the request's headers.GITLAB_USERNAME
andGITLAB_PASSWORD
were removed. See this comment for why.Automated Tests
There were no automated tests for GitLab download functionality before. There is one test that is skipped unless run manually.
This PR adds no tests.
QA Notes
I validated this against a private repo on my GitLab account. Validation is tricky, requiring a Packrat lock file that restores from a GitLab repository.
To validate:
GITLAB_PAT
.packrat
subdirectory. Runpackrat::restore()
. The environment should restore correctly.We should also confirm:
GITLAB_PAT
environment variable is missing, an error message is displayed.GITLAB_USERNAME
andGITLAB_PASSWORD
variables are present andGITLAB_PAT
is absent, the same error message aboutGITLAB_PAT
is displayed.Checklist