Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit d79398d

Browse files
committed
Add docs for GE injection
1 parent b9cd1d9 commit d79398d

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,55 @@ limited to Gradle "8.1.0" and later:
725725

726726
To use this plugin with versions of Gradle older than "8.1.0", you'll need to invoke Gradle with the
727727
configuration-cache disabled.
728+
729+
# Gradle Enterprise plugin injection
730+
731+
The `gradle-build-action` provides support for injecting and configuring the Gradle Enterprise Gradle plugin into any Gradle build, without any modification to the project sources.
732+
This is achieved via an init-script installed into Gradle User Home, which is enabled and parameterized via environment variables.
733+
734+
The same auto-injection behavior is available for the Common Custom User Data Gradle plugin, which enriches any build scans published with additional useful information.
735+
736+
## Enabling Gradle Enterprise injection
737+
738+
In order to enable Gradle Enterprise for your build, you must provide the required configuration via environment variables.
739+
740+
Here's a minimal example:
741+
742+
```yaml
743+
name: Run build with Gradle Enterprise injection
744+
745+
env:
746+
GRADLE_ENTERPRISE_INJECTION_ENABLED: true
747+
GRADLE_ENTERPRISE_INJECTION_SERVER_URL: https://ge.gradle.org
748+
GRADLE_ENTERPRISE_INJECTION_GE_PLUGIN_VERSION: 3.14.1
749+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_KEY }} # Required to publish scans to ge.gradle.org
750+
751+
jobs:
752+
build:
753+
runs-on: ubuntu-latest
754+
steps:
755+
- uses: actions/checkout@v3
756+
- name: Setup Gradle
757+
uses: gradle/gradle-build-action@v2
758+
- name: Run a Gradle build with Gradle Enterprise injection enabled
759+
run: ./gradlew build
760+
```
761+
762+
This configuration will automatically apply `v3.14.1` of the [Gradle Enterprise Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/), and publish build scans to https://ge.gradle.org.
763+
764+
Note that the `ge.gradle.org` server requires authentication in order to publish scans. The provided `GRADLE_ENTERPRISE_ACCESS_KEY` isn't required by the Gradle Enterprise injection script,
765+
but will be used by the GE plugin in order to authenticate with the server.
766+
767+
## Configuring Gradle Enterprise injection
768+
769+
The `init-script` supports a number of additional configuration parameters that you may fine useful. All configuration options (required and optional) are detailed below:
770+
771+
| Variable | Required | Description |
772+
| --- | --- | --- |
773+
| GRADLE_ENTERPRISE_INJECTION_ENABLED | :white_check_mark: | enables Gradle Enterprise injection |
774+
| GRADLE_ENTERPRISE_INJECTION_SERVER_URL | :white_check_mark: | the URL of the Gradle Enterprise server |
775+
| GRADLE_ENTERPRISE_INJECTION_ALLOW_UNTRUSTED_SERVER | | allow communication with an untrusted server; set to _true_ if your Gradle Enterprise instance is using a self-signed certificate |
776+
| GRADLE_ENTERPRISE_INJECTION_ENFORCE_SERVER_URL | | enforce the configured Gradle Enterprise URL over a URL configured in the project's build; set to _true_ to enforce publication of build scans to the configured Gradle Enterprise URL |
777+
| GRADLE_ENTERPRISE_INJECTION_GE_PLUGIN_VERSION | :white_check_mark: | the version of the [Gradle Enterprise Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/) to apply |
778+
| GRADLE_ENTERPRISE_INJECTION_CCUD_PLUGIN_VERSION | | the version of the [Common Custom User Data Gradle plugin](https://github.com/gradle/common-custom-user-data-gradle-plugin) to apply, if any |
779+
| GRADLE_ENTERPRISE_INJECTION_PLUGIN_REPOSITORY_URL | | the URL of the repository to use when resolving the GE and CCUD plugins; the Gradle Plugin Portal is used by default |

0 commit comments

Comments
 (0)