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

feat: requests to remote always include user-agent #21684

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lukevmorris
Copy link

I have a grpc Remote Execution API server that I use as a backend remote cache for both pants and bazel. I want to be able to distinguish between requests that came from bazel and those that came from pants. I originally relied on the user agent header but found that it was omitted if I configured any other headers.

In the reference sections for remote_execution_headers and remote_store_headers, the pants docs state that "Pants may add additional headers." I think User-Agent is one header that would be useful if always present.

This PR removes User-Agent from DEFAULT_EXECUTION_OPTIONS and opts instead to merge it with user-provided headers. That is, the following configuration:

[GLOBAL]
remote_store_headers = {"Authorization" = "Basic abc123"}

would result in the following HTTP Headers:

Authorization: Basic abc123
User-Agent: pants/2.21.0

These changes are intended to allow the user, if needed, to provide a custom user agent by setting it explicitly in remote_store_headers or remote_execution_headers. I'm not deeply familiar with python, so please let me know if there are any changes you'd like me to make. Thank you!

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.

1 participant