Hi, I have an issue with handling errors when using the credential helper to authenticate with a private bazel registry instance. The authentication process works correctly, but the errors from the credential-helper (which is a bash script) are not handled properly. For example, if I exit the credential helper with a non zero exit code, I receive messages like:
ERROR: Error computing the main repository mapping: module not found in registries:
and after multiple tries
Error retrieving auth headers, continuing without: Failed to get credentials for '<registry>' from helper '<helper>': process was interrupted
instead of the expected:
WARNING: Error retrieving auth headers, continuing without: Failed to get credentials for '<file>' from helper '<helper>': process exited with code 2. stderr: You need to generate refresh token by running script: <script> - The problem is that this last warning message only appears when I run the bazel build command multiple times with the helper added as common for all entries - common --credential_helper=<helper> . However, if I set credential helper for specific host with pattern or not - common --credential_helper=<host>=<helper>, the WARNING never appears.
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.
The simplest credential helper can look like that:
#!/bin/bash
echo "Token could not be created." >&2
exit 1
Description of the bug:
Hi, I have an issue with handling errors when using the credential helper to authenticate with a private bazel registry instance. The authentication process works correctly, but the errors from the credential-helper (which is a bash script) are not handled properly. For example, if I exit the credential helper with a non zero exit code, I receive messages like:
ERROR: Error computing the main repository mapping: module not found in registries:
and after multiple triesError retrieving auth headers, continuing without: Failed to get credentials for '<registry>' from helper '<helper>': process was interrupted
instead of the expected:
WARNING: Error retrieving auth headers, continuing without: Failed to get credentials for '<file>' from helper '<helper>': process exited with code 2. stderr: You need to generate refresh token by running script: <script>
- The problem is that this last warning message only appears when I run the bazel build command multiple times with the helper added as common for all entries -common --credential_helper=<helper>
. However, if I set credential helper for specific host with pattern or not -common --credential_helper=<host>=<helper>
, the WARNING never appears.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.
The simplest credential helper can look like that:
Then add the credential helper in .bazelrc
Which operating system are you running Bazel on?
SUSE Linux Enterprise Server 15 SP5
What is the output of
bazel info release
?release 7.3.1
If
bazel info release
returnsdevelopment 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
?No response
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?
Similar issues:
Any other information, logs, or outputs that you want to share?
No response