-
Notifications
You must be signed in to change notification settings - Fork 0
Support conventional access key sources #455
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the authentication mechanism from a simple API token to a more sophisticated access key resolution system that supports conventional Gradle and Maven access key sources. The changes enable the library to automatically discover access keys from environment variables and standard configuration files, matching the patterns used by Gradle and Maven build tools.
- Replaces
apiToken
withaccessKey
and implements multi-source key resolution - Adds support for conventional access key locations (environment variables and properties files)
- Updates all tests to use the new access key format with host-based key entries
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
library/src/main/kotlin/com/gabrielfeo/develocity/api/Config.kt | Replaces apiToken with accessKey and adds comprehensive documentation |
library/src/main/kotlin/com/gabrielfeo/develocity/api/internal/auth/AccessKeyResolver.kt | Implements access key resolution from multiple conventional sources |
library/src/main/kotlin/com/gabrielfeo/develocity/api/internal/auth/HostAccessKeyEntry.kt | Parses and validates host=key entry format |
library/src/test/kotlin/com/gabrielfeo/develocity/api/internal/auth/AccessKeyResolverTest.kt | Comprehensive test coverage for access key resolution logic |
library/src/test/kotlin/com/gabrielfeo/develocity/api/ConfigTest.kt | Updates Config tests for new access key functionality |
library/src/test/kotlin/com/gabrielfeo/develocity/api/DevelocityApiTest.kt | Updates test to use new access key naming |
library/src/test/kotlin/com/gabrielfeo/develocity/api/RetrofitTest.kt | Updates test helper to use access key format |
library/src/test/kotlin/com/gabrielfeo/develocity/api/OkHttpClientTest.kt | Updates test helper to use access key format |
library/src/integrationTest/kotlin/com/gabrielfeo/develocity/api/DevelocityApiIntegrationTest.kt | Updates integration test to use accessKey parameter |
library/src/main/kotlin/com/gabrielfeo/develocity/api/internal/OkHttpClient.kt | Updates HTTP client to use accessKey instead of apiToken |
library/api/library.api | Updates public API signature |
library/build.gradle.kts | Adds test dependencies for okio fake filesystem and JUnit parameterized tests |
gradle/libs.versions.toml | Adds dependency version declarations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
library/src/main/kotlin/com/gabrielfeo/develocity/api/internal/auth/HostAccessKeyEntry.kt
Outdated
Show resolved
Hide resolved
Job Summary for GradleCheck PR :: kotlin-tests
|
Job Summary for GradleCheck PR :: kotlin-tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Job Summary for GradleCheck PR :: kotlin-tests
|
ddd51e6
to
83916c3
Compare
Job Summary for GradleCheck PR :: kotlin-tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
2914cec
to
4c8d2a7
Compare
Job Summary for GradleCheck PR :: kotlin-tests |
4c8d2a7
to
a4350e4
Compare
As follow-up to #455 / #338, support the conventional server URL variable that's already set up for official Develocity tooling, such as - any Gradle project using [`common-custom-user-data-gradle-plugin`][1] with a set [Develocity URL override][2] - the [Develocity Python agent][3] `Config.apiUrl` and `DEVELOCITY_API_URL` are renamed to `Config.server` and `DEVELOCITY_URL` for consistency with official Develocity tooling nomenclature. `Config.server` is strongly typed as a URI and validation is improved. [1]: https://github.com/gradle/common-custom-user-data-gradle-plugin [2]: https://github.com/gradle/common-custom-user-data-gradle-plugin/tree/main?tab=readme-ov-file#configuration-overrides [3]: https://docs.gradle.com/develocity/python-agent/#environment_variables
Support using an access key from the conventional locations, matching the official tooling. Simplifies configuration for users of this library, which most likely also use the official tooling. Currently, they're required to set both
DEVELOCITY_API_TOKEN
(for this library) andDEVELOCITY_ACCESS_KEY
(for official tooling), which is possibly redundant if the access keys are from the same user and instance. If an access key different from the one defined in usual locations must be used for the API, then a customConfig.accessKey
is still supported. The name "API token" was also unintuitive considering that all Develocity documentation refers to them as "access keys". Resolves #338.This is a breaking change for projects using
DEVELOCITY_API_TOKEN
orConfig.apiToken
, targeting the upcoming 2025.1.0 major release.Thanks to @mcumings for providing an initial reference implementation.