Skip to content

Add support for GitHub auth token - #62

Merged
philwo merged 1 commit into
bazelbuild:masterfrom
keith:ks/github-auth-token
Jun 4, 2019
Merged

philwo merged 1 commit into
bazelbuild:masterfrom
keith:ks/github-auth-token

Conversation

@keith

@keith keith commented May 29, 2019

Copy link
Copy Markdown
Member

This adds support for BAZELISK_GITHUB_TOKEN which is a GitHub token used
for API requests when it is set. This fixes the issue of being on a
shared network and getting rate limited when using bazelisk.

Fixes #18

@keith keith mentioned this pull request May 29, 2019
Comment thread bazelisk.go
}

if token != "" {
req.Header.Set("Authorization", "token "+token)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This logic might be a bit too GitHub specific, if so I'm open to trying to break it up

Comment thread bazelisk.go
}

// We could also use go-github here, but I can't get it to build with Bazel's rules_go and it pulls in a lot of dependencies.
body, err := readRemoteFile(url)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

By doing this I've taken over maybeDownload, I'm happy to rename it if that makes sense.

@philwo
philwo requested a review from fweikert May 29, 2019 10:36

@philwo philwo 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.

Thanks @keith! I think this is fine.

By the way, we're also working on a different mechanism to fetch the available releases by querying the contents of the GCS bucket that Bazelisk is downloading Bazel from. This would make it completely independent of GitHub.

It would also be a first step to allowing people to override the download location, so that companies could use their own mirror.

This adds support for BAZELISK_GITHUB_TOKEN which is a GitHub token used
for API requests when it is set. This fixes the issue of being on a
shared network and getting rate limited when using bazelisk.

Fixes #18
@keith

keith commented May 29, 2019

Copy link
Copy Markdown
Member Author

Sounds great, at that point we could delete this

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.

Support GitHub API Token

2 participants