Skip to content
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

Parse .netrc for HTTP Basic authentication credentials when BAZELISK_BASE_URL points to protected resource #292

Merged
merged 6 commits into from
Jan 27, 2022

Conversation

Warchant
Copy link
Contributor

@Warchant Warchant commented Jan 20, 2022

This PR adds support for using .netrc file for getting credentials for Basic HTTP authentication to download bazel from protected resource.

Same as #269 but for Go code.

Fixes #291
Fixes #269

Tested with JFrog Artifactory.

@philwo philwo requested a review from fweikert January 20, 2022 09:21
@minmichail
Copy link

minmichail commented Jan 24, 2022

@fweikert sorry for pushing that already, but we would need that feature soon and we would like to use an official release in case review pass

var auth string = ""
t, err := tryFindNetrcFileCreds(u.Host)
if err == nil {
// successfully parsed netrc for given host
Copy link
Member

Choose a reason for hiding this comment

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

I'd fail here if the .netrc file exists, but could not be read (for whatever reasons).

Copy link
Member

Choose a reason for hiding this comment

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

It would also be good to add a log statement regarding whether a .netrc file was read or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd fail here if the .netrc file exists, but could not be read (for whatever reasons).

.netrc may exist, but may not contain given "Host". In this case we should proceed with normal auth, without a failure, because remote may not have auth at all.

httputil/httputil.go Outdated Show resolved Hide resolved
httputil/httputil.go Outdated Show resolved Hide resolved
@Warchant Warchant requested a review from fweikert January 25, 2022 11:40
@Warchant
Copy link
Contributor Author

Ping @fweikert

@fweikert fweikert merged commit 1e08882 into bazelbuild:master Jan 27, 2022
gcf-merge-on-green bot referenced this pull request in googleapis/gapic-generator-typescript Jul 22, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@bazel/bazelisk](https://github.com/bazelbuild/bazelisk) | [`^1.11.0` -> `^1.12.0`](https://renovatebot.com/diffs/npm/@bazel%2fbazelisk/1.11.0/1.12.0) | [![age](https://badges.renovateapi.com/packages/npm/@bazel%2fbazelisk/1.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@bazel%2fbazelisk/1.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@bazel%2fbazelisk/1.12.0/compatibility-slim/1.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@bazel%2fbazelisk/1.12.0/confidence-slim/1.11.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>bazelbuild/bazelisk</summary>

### [`v1.12.0`](https://github.com/bazelbuild/bazelisk/releases/tag/v1.12.0)

[Compare Source](https://github.com/bazelbuild/bazelisk/compare/v1.11.0...v1.12.0)

This release brings new features and fixes to both versions of Bazelisk:

Go:

-   Added support for basic HTTP authentication via a .netrc file ([https://github.com/bazelbuild/bazelisk/pull/292](https://github.com/bazelbuild/bazelisk/pull/292))
-   Improved and fixed Apple Silicon support ([https://github.com/bazelbuild/bazelisk/pull/299](https://github.com/bazelbuild/bazelisk/pull/299), [https://github.com/bazelbuild/bazelisk/pull/303](https://github.com/bazelbuild/bazelisk/pull/303))
-   Rolling releases are now fetched from GCS instead of GitHub ([https://github.com/bazelbuild/bazelisk/pull/319](https://github.com/bazelbuild/bazelisk/pull/319))

Python:

-   Added support for Apple Silicon ([https://github.com/bazelbuild/bazelisk/pull/272](https://github.com/bazelbuild/bazelisk/pull/272))
-   Implemented verification of downloaded Bazel binaries ([https://github.com/bazelbuild/bazelisk/pull/295](https://github.com/bazelbuild/bazelisk/pull/295))

We'd like to thank our contributors [@&#8203;chenrui333](https://github.com/chenrui333), [@&#8203;codeman9](https://github.com/codeman9), [@&#8203;cpsauer](https://github.com/cpsauer), [@&#8203;keith](https://github.com/keith), [@&#8203;linzhp](https://github.com/linzhp), [@&#8203;Warchant](https://github.com/Warchant) and [@&#8203;xinnjie](https://github.com/xinnjie)!

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-typescript).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMjIuMSIsInVwZGF0ZWRJblZlciI6IjMyLjEyMi4xIn0=-->
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 using netrc file for bazel downloads in go version
4 participants