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

Auth plugins can inspect the prior result, set an expiration, and override --remote-{store,execution}-address (Cherry-pick of #12029) #12046

Merged
merged 1 commit into from May 10, 2021

Conversation

Eric-Arellano
Copy link
Contributor

No description provided.

…rride `--remote-{store,execution}-address` (pantsbuild#12029)

pantsbuild#12020 results in auth plugins being executed every run of `./pants`, even when Pantsd is used. 

While correct, that is a problem for auth plugins like Toolchain's that are stateless and give back a new token every time. Getting a new token changes the `store_headers`, which changes the bootstrap options sent over FFI to Rust to create the scheduler; we must reinitialize the scheduler in this case, which is slow.

Instead, we now pass `prior_result: AuthPluginResult | None` to the auth plugin hook, which allows plugins to recycle prior results if they'd like. We also allow plugins to set `expiration` on the `AuthPluginResult`, which is particularly useful for plugins deciding to recycle a token vs. generate a new one. 

Finally, we allow the plugin to override `--remote-store-address` and `--remote-execution-address`, which isn't totally related to this PR but has been requested as a feature and is done here to reduce churn in the API.

Combined, this PR allows plugin authors to avoid the problem of invalidating Pantsd every run, while avoiding the problem that Pantsd blocked every regenerating tokens until a restart. Closes pantsbuild#12018.

[ci skip-rust]
[ci skip-build-wheels]
@Eric-Arellano Eric-Arellano merged commit 9f06ae9 into pantsbuild:2.5.x May 10, 2021
@Eric-Arellano Eric-Arellano deleted the cp-auth-plugin branch May 10, 2021 22:59
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.

None yet

2 participants