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

httputil: Avoid displaying percentage in download progress when response Content-Length is not defined #539

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Conversation

LINKIWI
Copy link
Contributor

@LINKIWI LINKIWI commented Jan 28, 2024

Summary

Content-Length may not necessarily be defined in the HTTP response headers for the Bazel binary blob. For example, this may be the case for mirrors or proxies that transmit the body using chunked transfer encoding. In such cases, the "total" is not meaningful, which breaks the percentage text in the new download progress indicator.

This patch updates the progress message text to handle such cases.

Extends: #511

Symptom

$ bazelisk --help
2024/01/28 06:35:59 Downloading https://artifacts.internal.example.com/bazel/6.5.0/bazel-6.5.0-linux-x86_64...
Downloading: 8 MB out of 0 MB (-881459200%)

Verification

Downloading from a proprietary mirror that elides Content-Length:

$ bazelisk-linux_amd64 --help
2024/01/28 06:27:19 Downloading https://artifacts.internal.example.com/bazel/6.5.0/bazel-6.5.0-linux-x86_64...
Downloading: 52 MB                     
Starting local Bazel server and connecting to it...
                                                           [bazel release 6.5.0]
Usage: bazel <command> <options> ...

Available commands:
  analyze-profile     Analyzes build profile data.
  aquery              Analyzes the given targets and queries the action graph.
  build               Builds the specified targets.
  canonicalize-flags  Canonicalizes a list of bazel options.
  clean               Removes output files and optionally stops the server.
  coverage            Generates code coverage report for specified test targets.
  cquery              Loads, analyzes, and queries the specified targets w/ configurations.
  dump                Dumps the internal state of the bazel server process.
  fetch               Fetches external repositories that are prerequisites to the targets.
  help                Prints help for commands, or the index.
  info                Displays runtime info about the bazel server.
  license             Prints the license of this software.
  mobile-install      Installs targets to mobile devices.
  mod                 Queries the Bzlmod external dependency graph
  print_action        Prints the command line args for compiling a file.
  query               Executes a dependency graph query.
  run                 Runs the specified target.
  shutdown            Stops the bazel server.
  sync                Syncs all repositories specified in the workspace file
  test                Builds and runs the specified test targets.
  version             Prints version information for bazel.

Getting more help:
  bazel help <command>
                   Prints help and options for <command>.
  bazel help startup_options
                   Options for the JVM hosting bazel.
  bazel help target-syntax
                   Explains the syntax for specifying targets.
  bazel help info-keys
                   Displays a list of keys used by the info command.

Downloading from the public repository:

$ bazelisk-linux_amd64 --help
2024/01/28 06:30:07 Downloading https://releases.bazel.build/6.5.0/release/bazel-6.5.0-linux-x86_64...
Downloading: 52 MB out of 52 MB (100%) 
                                                           [bazel release 6.5.0]
Usage: bazel <command> <options> ...

Available commands:
  analyze-profile     Analyzes build profile data.
  aquery              Analyzes the given targets and queries the action graph.
  build               Builds the specified targets.
  canonicalize-flags  Canonicalizes a list of bazel options.
  clean               Removes output files and optionally stops the server.
  coverage            Generates code coverage report for specified test targets.
  cquery              Loads, analyzes, and queries the specified targets w/ configurations.
  dump                Dumps the internal state of the bazel server process.
  fetch               Fetches external repositories that are prerequisites to the targets.
  help                Prints help for commands, or the index.
  info                Displays runtime info about the bazel server.
  license             Prints the license of this software.
  mobile-install      Installs targets to mobile devices.
  mod                 Queries the Bzlmod external dependency graph
  print_action        Prints the command line args for compiling a file.
  query               Executes a dependency graph query.
  run                 Runs the specified target.
  shutdown            Stops the bazel server.
  sync                Syncs all repositories specified in the workspace file
  test                Builds and runs the specified test targets.
  version             Prints version information for bazel.

Getting more help:
  bazel help <command>
                   Prints help and options for <command>.
  bazel help startup_options
                   Options for the JVM hosting bazel.
  bazel help target-syntax
                   Explains the syntax for specifying targets.
  bazel help info-keys
                   Displays a list of keys used by the info command.

@LINKIWI LINKIWI changed the title httputil: Avoid displaying percentage in download progress when content length is not defined httputil: Avoid displaying percentage in download progress when response Content-Length is not defined Jan 28, 2024
@LINKIWI
Copy link
Contributor Author

LINKIWI commented Feb 8, 2024

@fweikert @katre Any chance you could help review this change? Thanks.

@katre
Copy link
Member

katre commented Feb 8, 2024

Sorry this sat for so long: I can't merge it but I'll talk to the admins.

@fweikert fweikert merged commit 006c13b into bazelbuild:master Feb 8, 2024
2 checks passed
ti-chi-bot bot referenced this pull request in PingCAP-QE/artifacts Jul 3, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [bazelbuild/bazelisk](https://github.com/bazelbuild/bazelisk) |
minor | `v1.19.0` -> `v1.20.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/bazelisk (bazelbuild/bazelisk)</summary>

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

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

Bazelisk v1.20.0 comes with several significant changes:

### New Features

- The Go version now supports `BAZELISK_NOJDK`
([https://github.com/bazelbuild/bazelisk/pull/531](https://github.com/bazelbuild/bazelisk/pull/531))

### Bug Fixes & Improvements

- It's now easier to use Bazelisk programmatically
([https://github.com/bazelbuild/bazelisk/pull/500](https://github.com/bazelbuild/bazelisk/pull/500),
[https://github.com/bazelbuild/bazelisk/pull/526](https://github.com/bazelbuild/bazelisk/pull/526))
- Bazelisk will retry more connection errors
([https://github.com/bazelbuild/bazelisk/pull/529](https://github.com/bazelbuild/bazelisk/pull/529),
[https://github.com/bazelbuild/bazelisk/pull/530](https://github.com/bazelbuild/bazelisk/pull/530))
- A display bug in the download progress bar has been fixed
([https://github.com/bazelbuild/bazelisk/pull/539](https://github.com/bazelbuild/bazelisk/pull/539))

We’d like to thank our amazing contributors
[@&#8203;afq984](https://github.com/afq984),
[@&#8203;comius](https://github.com/comius),
[@&#8203;francine-blanc](https://github.com/francine-blanc),
[@&#8203;illicitonion](https://github.com/illicitonion),
[@&#8203;jwnimmer-tri](https://github.com/jwnimmer-tri),
[@&#8203;LINKIWI](https://github.com/LINKIWI),
[@&#8203;mmorel-35](https://github.com/mmorel-35) and
[@&#8203;sf-jbazuzi](https://github.com/sf-jbazuzi)!

</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 becomes conflicted, 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, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/PingCAP-QE/artifacts).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJoZWxwIHdhbnRlZCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

3 participants