Skip to content

Allowed to fail, asynchronousrepository_ctx.download still reports as pending download after failure, swallowing the error #28732

@ArchangelX360

Description

@ArchangelX360

Description of the bug:

When using allow_fail = True and block = False, repository_ctx.download failed downloads:

  • are reported incorrectly to still be pending
  • not allowing the user to retrieve the actual error which is firing in allow_fail = False
Error in wait: java.io.IOException: Configured URL rewriter blocked all URLs: [https://raw.githubusercontent.com/tikv/jemallocator/baae33dd29ccd82c8330021418b293fa6eab5bbc/Cargo.toml]

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Create a downloader config
# myconfig.cfg
block *
  1. Set it as --downloader_config=myconfig.cfg
  2. In a repository rule, run:
token = ctx.download(
    "https://raw.githubusercontent.com/tikv/jemallocator/baae33dd29ccd82c8330021418b293fa6eab5bbc/Cargo.toml",
    output = "Cargo.toml",
    allow_fail = True,
    block = False,
)
print(token)        # prints <pending download to '/Users/titouan.bion/Library/Caches/JetBrains/MonorepoBazel/aa71b1dc3fd25eda1f9f28ad27b5446f/modextwd/rules_rs++crate/Cargo.toml'>
print(token.wait()) # prints `struct(success = False)`
print(token)        # prints <pending download to '/Users/titouan.bion/Library/Caches/JetBrains/MonorepoBazel/aa71b1dc3fd25eda1f9f28ad27b5446f/modextwd/rules_rs++crate/Cargo.toml'>

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions