Skip to content

Commit

Permalink
Develocity injection fixes (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz authored Nov 16, 2024
2 parents fb5165d + 333e9d9 commit a09a310
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflow-samples/groovy-dsl/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.gradle.develocity" version "3.18.2"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.1"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.2"
}

develocity {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflow-samples/kotlin-dsl/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.gradle.develocity") version "3.18.2"
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.0.1"
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.0.2"
}

develocity {
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integ-test-inject-develocity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
DEVELOCITY_INJECTION_ENABLED: true
DEVELOCITY_URL: https://ge.solutions-team.gradle.com
DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0'
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0.2'
${{matrix.accessKeyEnv}}: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
DEVELOCITY_INJECTION_ENABLED: true
DEVELOCITY_URL: 'https://ge.solutions-team.gradle.com'
DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0'
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0.2'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
DEVELOCITY_INJECTION_ENABLED: true
DEVELOCITY_URL: 'https://localhost:3333/'
DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0'
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0.2'
# Access key also set as an env var, we want to check it does not leak
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
Expand Down
19 changes: 12 additions & 7 deletions sources/src/develocity/build-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,29 @@ import {setupToken} from './short-lived-token'
export async function setup(config: BuildScanConfig): Promise<void> {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle')
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions')
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.18.2')
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0')
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl())
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree())
}

maybeExportVariableNotEmpty('DEVELOCITY_INJECTION_ENABLED', config.getDevelocityInjectionEnabled())
maybeExportVariableNotEmpty('DEVELOCITY_URL', config.getDevelocityUrl())
maybeExportVariableNotEmpty('DEVELOCITY_ALLOW_UNTRUSTED_SERVER', config.getDevelocityAllowUntrustedServer())
maybeExportVariableNotEmpty('DEVELOCITY_CAPTURE_FILE_FINGERPRINTS', config.getDevelocityCaptureFileFingerprints())
maybeExportVariableNotEmpty('DEVELOCITY_ENFORCE_URL', config.getDevelocityEnforceUrl())
maybeExportVariableNotEmpty('DEVELOCITY_PLUGIN_VERSION', config.getDevelocityPluginVersion())
maybeExportVariableNotEmpty('DEVELOCITY_CCUD_PLUGIN_VERSION', config.getDevelocityCcudPluginVersion())
maybeExportVariableNotEmpty('GRADLE_PLUGIN_REPOSITORY_URL', config.getGradlePluginRepositoryUrl())
maybeExportVariableNotEmpty('GRADLE_PLUGIN_REPOSITORY_USERNAME', config.getGradlePluginRepositoryUsername())
maybeExportVariableNotEmpty('GRADLE_PLUGIN_REPOSITORY_PASSWORD', config.getGradlePluginRepositoryPassword())

// If build-scan-publish is enabled, ensure the environment variables are set
// The DEVELOCITY_PLUGIN_VERSION and DEVELOCITY_CCUD_PLUGIN_VERSION are set to the latest versions
// except if they are defined in the configuration
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.18.2')
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0.2')
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl())
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree())
}

return setupToken(config.getDevelocityAccessKey(), config.getDevelocityTokenExpiry())
}

Expand Down
2 changes: 1 addition & 1 deletion sources/test/init-scripts/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.gradle.develocity" version "3.18.2"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.1"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.2"
}

develocity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import java.util.zip.GZIPOutputStream

class BaseInitScriptTest extends Specification {
static final String DEVELOCITY_PLUGIN_VERSION = '3.18.2'
static final String CCUD_PLUGIN_VERSION = '2.0.1'
static final String CCUD_PLUGIN_VERSION = '2.0.2'

static final TestGradleVersion GRADLE_3_X = new TestGradleVersion(GradleVersion.version('3.5.1'), 7, 9)
static final TestGradleVersion GRADLE_4_X = new TestGradleVersion(GradleVersion.version('4.10.3'), 7, 10)
Expand Down

0 comments on commit a09a310

Please sign in to comment.