GitLab CI
|
Prerequisites
|
Use the Develocity GitLab Templates
The Develocity GitLab templates configure the Develocity Gradle plugin or Maven extension at the CI level, publishing a Build Scan without modifying your Gradle or Maven build scripts.
Include the templates in your .gitlab-ci.yml and set the required CI/CD variables.
Refer to the Develocity GitLab Templates repository for the full include: configuration and the list of supported variables.
Store the Access Key as a CI/CD Variable
Store your Develocity access key as a GitLab CI/CD variable named DEVELOCITY_ACCESS_KEY.
Mark it as Masked to prevent the value from appearing in job logs.
The access key value uses the format «server host name»=«access key»:
develocity.example.com=7w5kbqqjea4vonghohvuyra5bnvszop4asbqee3m3sm6dbjdudtq
Authenticate With Workload Identity
Instead of the stored CI/CD variable from Store the Access Key as a CI/CD Variable, mint an OIDC token for each job and set the same DEVELOCITY_ACCESS_KEY from it.
The Develocity GitLab templates exchange it for a short-lived Develocity access token the same way they exchange an access key.
|
Configure a Workload Identity rule in Develocity before using this flow, using the GitLab CI provider example on that page for the issuer and audience.
The |
Add an id_tokens: block to the job and set DEVELOCITY_ACCESS_KEY from the minted token, in host-qualified «server host name»=«token» form:
build:
id_tokens:
DV_OIDC_TOKEN:
aud: https://develocity.example.com
before_script:
- export DEVELOCITY_ACCESS_KEY="develocity.example.com=$DV_OIDC_TOKEN"
script:
- ./gradlew build
The Gradle plugin rejects a bare token, so keep the host name prefix.
Verify the Integration
After your first pipeline run, open your Develocity server and navigate to Build Scan. Your build should appear there. Install the Common Custom User Data plugin to tag builds as CI and enrich each Build Scan with the Git branch, commit SHA, and a link back to the GitLab CI pipeline.