From ea9a4f1af3b1c4b14896f3f61d149d3e7bacb810 Mon Sep 17 00:00:00 2001 From: Gabriel Feo Date: Sat, 23 Aug 2025 19:18:43 +0100 Subject: [PATCH 1/3] Update README and examples (cherry picked from commit 83916c3789f3212c1a0abbf6d8243eebce4f6e3e) --- README.md | 29 ++++++++++++++++--- .../MostFrequentBuilds.ipynb | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8e279b34..79aa8e01 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,31 @@ This library [fixes][34] those issues in generated code, implements [paging][24] ## Setup -Set up environment variables and use the library from any notebook, script or project: +Set up once and use the library from any notebook, script or project: - [`DEVELOCITY_API_URL`][16]: the URL of your Develocity instance -- [`DEVELOCITY_API_TOKEN`][17]: an [access key][31] for the Develocity instance - [`DEVELOCITY_API_CACHE_ENABLED`][12] (optional, off by default): enables caching for some requests (see [caveats][13]) +- An access key in one of the supported locations + +
+ +Supported access key locations + +Access key support matches that of official tooling: the Develocity [Gradle Plugin][37] and [Maven Extension][38]. +If you've already provisioned a key for your build to connect to Develocity, there's probably no action needed. +Supported locations, in order of precedence: + +- a provider function as [`Config.accessKey`][17] (see [optional setup](#optional-setup)) +- official tooling locations with value in format `host=key`, e.g. `DEVELOCITY_ACCESS_KEY='foo.com=my-key'`: + - [`DEVELOCITY_ACCESS_KEY`](https://docs.gradle.com/develocity/gradle-plugin/current/#manual_access_key_configuration) + - [`GRADLE_ENTERPRISE_ACCESS_KEY`](https://docs.gradle.com/develocity/gradle-plugin/current/#manual_access_key_configuration) + - File `$GRADLE_USER_HOME/.gradle/develocity/keys.properties`, or `~/.gradle/develocity/keys.properties` if `GRADLE_USER_HOME` is not set + - File `~/.m2/.develocity/keys.properties` + +Refer to the Develocity [Gradle Plugin User Manual][37] or [Maven Extension User Manual][38] for details on these variables and files, including support for keys of multiple hosts. + +
### Setup snippets @@ -172,7 +191,7 @@ your own. For example: ```kotlin val config = Config( apiUrl = "https://ge.mycompany.com/api/", - apiToken = { vault.getGeApiToken() }, + accessKey = { vault.getDevelocityAccessKey() }, clientBuilder = existingClient.newBuilder(), ) val api = DevelocityApi.newInstance(config) @@ -214,7 +233,7 @@ For general discussions or questions, feel free to reach out to maintainers on t [13]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/-cache-config/index.html [14]: https://central.sonatype.com/artifact/com.gabrielfeo/develocity-api-kotlin/2024.3.0 [16]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/api-url.html -[17]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/api-token.html +[17]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/access-key.html [18]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/index.html [19]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api.model/-gradle-attributes/index.html [20]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/index.html @@ -234,3 +253,5 @@ For general discussions or questions, feel free to reach out to maintainers on t [34]: https://github.com/gabrielfeo/develocity-api-kotlin/blob/main/build-logic/src/functionalTest/kotlin/com/gabrielfeo/task/PostProcessGeneratedApiTest.kt#L21 [35]: https://community.gradle.org/#community-channels [36]: ./examples/example-gradle-task/ +[37]: https://docs.gradle.com/develocity/gradle-plugin/current/#manual_access_key_configuration +[38]: https://docs.gradle.com/develocity/maven-extension/current/#manual_access_key_configuration diff --git a/examples/example-notebooks/MostFrequentBuilds.ipynb b/examples/example-notebooks/MostFrequentBuilds.ipynb index afa3ba85..a3052a35 100644 --- a/examples/example-notebooks/MostFrequentBuilds.ipynb +++ b/examples/example-notebooks/MostFrequentBuilds.ipynb @@ -9,7 +9,7 @@ "source": [ "# Most frequent builds\n", "\n", - "See what builds are most commonly invoked by developers, e.g. `clean assemble`, `test` or `check`. You can [set up the URL and a token for your Develocity instance](https://github.com/gabrielfeo/develocity-api-kotlin/blob/main/README.md#setup) and run this notebook as-is for your own project.\n", + "See what builds are most commonly invoked by developers, e.g. `clean assemble`, `test` or `check`. You can [set up the URL and an access key for your Develocity instance](https://github.com/gabrielfeo/develocity-api-kotlin/blob/main/README.md#setup) and run this notebook as-is for your own project.\n", "\n", "This is a simple example of something you can do with the API. It could bring insights, for example:\n", "\n", From 22cdbe3f277dce2ded8005a816e01c62aebdf28a Mon Sep 17 00:00:00 2001 From: Gabriel Feo Date: Sun, 24 Aug 2025 04:14:47 +0100 Subject: [PATCH 2/3] Update for DEVELOCITY_URL --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 79aa8e01..0ad54396 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This library [fixes][34] those issues in generated code, implements [paging][24] Set up once and use the library from any notebook, script or project: -- [`DEVELOCITY_API_URL`][16]: the URL of your Develocity instance +- [`DEVELOCITY_URL`][16]: the URL of your Develocity instance - [`DEVELOCITY_API_CACHE_ENABLED`][12] (optional, off by default): enables caching for some requests (see [caveats][13]) - An access key in one of the supported locations @@ -190,7 +190,7 @@ your own. For example: ```kotlin val config = Config( - apiUrl = "https://ge.mycompany.com/api/", + develocityUrl = "https://ge.mycompany.com/", accessKey = { vault.getDevelocityAccessKey() }, clientBuilder = existingClient.newBuilder(), ) From 499bfe7a936c8290edf1b340873311fa04d2ea50 Mon Sep 17 00:00:00 2001 From: Gabriel Feo Date: Thu, 28 Aug 2025 19:41:54 +0100 Subject: [PATCH 3/3] Update link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ad54396..593e1751 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ For general discussions or questions, feel free to reach out to maintainers on t [12]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/-cache-config/cache-enabled.html [13]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/-cache-config/index.html [14]: https://central.sonatype.com/artifact/com.gabrielfeo/develocity-api-kotlin/2024.3.0 -[16]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/api-url.html +[16]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/server.html [17]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/access-key.html [18]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/index.html [19]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api.model/-gradle-attributes/index.html