diff --git a/.github/workflow-samples/groovy-dsl/settings.gradle b/.github/workflow-samples/groovy-dsl/settings.gradle index 1ef22e9c..123e2d41 100644 --- a/.github/workflow-samples/groovy-dsl/settings.gradle +++ b/.github/workflow-samples/groovy-dsl/settings.gradle @@ -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 { diff --git a/.github/workflow-samples/kotlin-dsl/settings.gradle.kts b/.github/workflow-samples/kotlin-dsl/settings.gradle.kts index 033c9896..42af587b 100644 --- a/.github/workflow-samples/kotlin-dsl/settings.gradle.kts +++ b/.github/workflow-samples/kotlin-dsl/settings.gradle.kts @@ -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 { diff --git a/.github/workflows/integ-test-inject-develocity.yml b/.github/workflows/integ-test-inject-develocity.yml index c05265e9..daef6e2e 100644 --- a/.github/workflows/integ-test-inject-develocity.yml +++ b/.github/workflows/integ-test-inject-develocity.yml @@ -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 @@ -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: @@ -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 }} diff --git a/sources/src/develocity/build-scan.ts b/sources/src/develocity/build-scan.ts index c8b49bfd..1f4f5846 100644 --- a/sources/src/develocity/build-scan.ts +++ b/sources/src/develocity/build-scan.ts @@ -5,13 +5,6 @@ import {setupToken} from './short-lived-token' export async function setup(config: BuildScanConfig): Promise { 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()) @@ -19,10 +12,22 @@ export async function setup(config: BuildScanConfig): Promise { 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()) } diff --git a/sources/test/init-scripts/settings.gradle b/sources/test/init-scripts/settings.gradle index 5f8f79cd..cb540fd0 100644 --- a/sources/test/init-scripts/settings.gradle +++ b/sources/test/init-scripts/settings.gradle @@ -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 { diff --git a/sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy b/sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy index d05bf3ab..4c1bffa7 100644 --- a/sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy +++ b/sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy @@ -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)