forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
--remote-auth-plugin
(pantsbuild#11503)
### Problem Currently, remote caching/execution users can set authentication headers two ways: 1. Hardcoding via `--remote-store-headers` and `--remote-execution-headers`. 2. Storing in a file and using `--remote-oauth-bearer-token-path` and having Pants auto-set the relevant header. However, this does not work for more complex cases where the headers should be dynamically set, such as wanting to make a network request to get an auth token, or consuming Pants options to determine the behavior. While users could write scripts to get the token and set it via env var, that does not scale very well and we want to provide a more robust first-class solution to dynamically setting auth headers. ### Solution Add a simple plugin hook that allows users to write a function that does any arbitrary logic necessary and returns a standardized `AuthPluginResult` object. This will get called at the start of every Pants run. Note that this plugin cannot use the Rules API, as it is used to determine the options that are used to initialize the Rust CommandRunner and Store. (Chicken and egg problem). Given this, the plugin runs pre-memoization so we do not need to worry about caching semantics here. One expected user of this feature (Toolchain) needs the ability to consume arbitrary subsystems, so we rewire some things to pass an `Options` object to the `ExecutionOptions` constructor.
- Loading branch information
1 parent
b4602e7
commit 24471ac
Showing
9 changed files
with
269 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.