-
Notifications
You must be signed in to change notification settings - Fork 91
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
Support using GITLAB_PAT
for authentication
#674
Conversation
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 @aronatkins , do you think it makes sense to remove the |
@aronatkins I removed
Removing it from Packrat will avoid sending users down a dead end. |
89c2466
to
79c6f5f
Compare
gitlab_pwd <- function(quiet = FALSE) { | ||
pwd <- Sys.getenv("GITLAB_PASSWORD") | ||
if (nzchar(pwd)) { | ||
gitlab_pat <- function(quiet = FALSE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that the bitbucket and gitlab accessor functions are exported by packrat. I don't think that it was our intent to allow packrat::gitlab_pat
. That said, it's out in the wild. :(
CC @kevinushey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think they are actually exported! They don't have the @export
keyword, they don't appear in NAMESPACE
, and you need to use :::
to access them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They do have documentation generated, but it isn't included in the index, because they include @keyword internal
in a roxygen2
comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that's correct -- they're documented but not exported.
CI is failing on |
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