Skip to content

Commit

Permalink
Check if configured DV plugin version is unsupported (#35)
Browse files Browse the repository at this point in the history
Also updates the release process to expect a version without 'v' prefix.

Fixes #27 
Fixes #34
  • Loading branch information
bigdaz authored Feb 5, 2025
2 parents 471cf19 + a08f072 commit 56d9e3b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gradle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: "Version with leading 'v' (eg v1.1.0)"
description: "Version without 'v' (eg '1.1' or '1.1.1')"
type: string
required: true

Expand Down Expand Up @@ -45,8 +45,8 @@ jobs:
commit_author: bot-githubaction <bot-githubaction@gradle.com>
commit_user_name: bot-githubaction
commit_user_email: bot-githubaction@gradle.com
commit_message: '[bot] Promote init-script as ${{ inputs.version }}'
tagging_message: '${{ inputs.version }}'
commit_message: '[bot] Promote init-script as v${{ inputs.version }}'
tagging_message: 'v${{ inputs.version }}'

update-gradle-actions:
needs: [update-reference]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-send-update-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ jobs:
token: ${{ secrets.GH_BOT_GITHUB_TOKEN }}
branch: bot/develocity-injection-init-script-update
delete-branch: true
title: 'Update develocity-injection init script to ${{ inputs.version }}'
title: 'Update develocity-injection init script to v${{ inputs.version }}'
body: |
Updates the develocity-injection init script to the latest reference script content
from https://github.com/gradle/develocity-ci-injection.
commit-message: |
Update develocity-injection init script to ${{ inputs.version }}
Update develocity-injection init script to v${{ inputs.version }}
Updates the develocity-injection init script to the latest reference script content
from https://github.com/gradle/develocity-ci-injection.
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/develocity-injection.init.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ void enableDevelocityInjection() {
logger.lifecycle("Accepting Gradle Terms of Use: $buildScanTermsOfUseUrl")
}

// finish early if DV plugin version is unsupported (v3.6.4 is the minimum version tested and supports back to DV 2021.1)
if (develocityPluginVersion && isNotAtLeast(develocityPluginVersion, '3.6.4')) {
logger.warn("Develocity Gradle plugin must be at least 3.6.4. Configured version is $develocityPluginVersion.")
return
}

// finish early if configuration parameters passed in via system properties are not valid/supported
if (ccudPluginVersion && isNotAtLeast(ccudPluginVersion, '1.7')) {
logger.warn("Common Custom User Data Gradle plugin must be at least 1.7. Configured version is $ccudPluginVersion.")
Expand Down
15 changes: 15 additions & 0 deletions src/test/groovy/com/gradle/TestDevelocityInjection.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,21 @@ class TestDevelocityInjection extends BaseInitScriptTest {
testGradle << ALL_GRADLE_VERSIONS
}

@Requires({data.testGradle.compatibleWithCurrentJvm})
def "stops gracefully when requested DV plugin version is < 3.6.4"() {
when:
def config = testConfig('3.6.3')
def result = run(testGradle, config)

then:
outputMissesDevelocityPluginApplicationViaInitScript(result)
outputMissesCcudPluginApplicationViaInitScript(result)
result.output.contains('Develocity Gradle plugin must be at least 3.6.4. Configured version is 3.6.3.')

where:
testGradle << ALL_GRADLE_VERSIONS
}

@Requires({data.testGradle.compatibleWithCurrentJvm})
def "can configure Develocity via CCUD system property overrides when plugins are injected via init script"() {
when:
Expand Down

0 comments on commit 56d9e3b

Please # to comment.