From a90d4ee430ea4dd9d9d4dc3ded5c82565e75e25b Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 12 Apr 2023 23:07:56 +0800 Subject: [PATCH 1/3] CURATOR-669. Integrate with ge.apache.org Gradle Enterprise server Signed-off-by: tison --- .github/workflows/ci.yml | 11 +++++ .gitignore | 5 ++ .mvn/ge-extensions.xml | 34 +++++++++++++ .../gradle-enterprise-custom-user-data.groovy | 46 +++++++++++++++++ .mvn/gradle-enterprise.xml | 49 +++++++++++++++++++ 5 files changed, 145 insertions(+) create mode 100644 .mvn/ge-extensions.xml create mode 100644 .mvn/gradle-enterprise-custom-user-data.groovy create mode 100644 .mvn/gradle-enterprise.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 905ce9ca8b..fed0b3dea4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,17 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Configure Gradle Enterprise integration + run: | + if [[ -n "${{ secrets.GE_ACCESS_TOKEN }}" ]]; then + echo "Configuring Gradle Enterprise for build" + cp .mvn/ge-extensions.xml .mvn/extensions.xml + echo "GRADLE_ENTERPRISE_ACCESS_KEY=${{ secrets.GE_ACCESS_TOKEN }}" >> $GITHUB_ENV + echo "GRADLE_ENTERPRISE_ACCESS_KEY has been configured" + else + echo "GRADLE_ENTERPRISE_ACCESS_KEY is not configured." + fi + - name: Cache Local Maven Repository uses: actions/cache@v3 with: diff --git a/.gitignore b/.gitignore index b6b15f2ba0..d7569d413b 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,8 @@ atlassian-ide-plugin.xml # NetBeans specific files/directories .nbattrs + +# Gradle Enterprise +test-reports/ +.mvn/.gradle-enterprise/ +.mvn/extensions.xml diff --git a/.mvn/ge-extensions.xml b/.mvn/ge-extensions.xml new file mode 100644 index 0000000000..04a32a79e7 --- /dev/null +++ b/.mvn/ge-extensions.xml @@ -0,0 +1,34 @@ + + + + + com.gradle + gradle-enterprise-maven-extension + 1.16.3 + + + com.gradle + common-custom-user-data-maven-extension + 1.11.1 + + diff --git a/.mvn/gradle-enterprise-custom-user-data.groovy b/.mvn/gradle-enterprise-custom-user-data.groovy new file mode 100644 index 0000000000..393a2c0108 --- /dev/null +++ b/.mvn/gradle-enterprise-custom-user-data.groovy @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Add Maven command line arguments +def mavenCommand = '' + +if (System.env.MAVEN_CMD_LINE_ARGS) { + mavenCommand = "mvn ${System.env.MAVEN_CMD_LINE_ARGS}".toString() + buildScan.value('Maven command line', mavenCommand) +} + +if (System.env.GITHUB_ACTIONS) { + if (session.goals.size() == 1 && session.goals[0] == 'initialize') { + // omit publishing build scan when the only goal is "initialize" + buildScan.publishOnDemand() + } else { + def jobName = System.env.GITHUB_JOB + buildScan.value('GitHub Actions Job name', jobName) + buildScan.value('GitHub Actions Event name', System.env.GITHUB_EVENT_NAME) + buildScan.value('GitHub Ref name', System.env.GITHUB_REF_NAME) + buildScan.value('GitHub Actor', System.env.GITHUB_ACTOR) + buildScan.link('GitHub Repository', "https://github.com/" + System.env.GITHUB_REPOSITORY) + buildScan.link('GitHub Commit', "https://github.com/" + System.env.GITHUB_REPOSITORY + "/commits/" + System.env.GITHUB_SHA) + buildScan.buildScanPublished { publishedBuildScan -> + new File(System.env.GITHUB_STEP_SUMMARY).withWriterAppend { out -> + out.println("\n[Gradle build scan for '${mavenCommand}' in ${jobName}](${publishedBuildScan.buildScanUri})\n") + } + } + } +} diff --git a/.mvn/gradle-enterprise.xml b/.mvn/gradle-enterprise.xml new file mode 100644 index 0000000000..9df9a64ea1 --- /dev/null +++ b/.mvn/gradle-enterprise.xml @@ -0,0 +1,49 @@ + + + + + https://ge.apache.org + false + + + + true + true + true + + #{isFalse(env['GITHUB_ACTIONS'])} + ALWAYS + + #{{'0.0.0.0'}} + + + + + #{isFalse(env['GITHUB_ACTIONS'])} + + + false + + + From a298df5c9296421766c74e7d4ac557aa710a0620 Mon Sep 17 00:00:00 2001 From: tison Date: Sat, 29 Apr 2023 10:59:58 +0800 Subject: [PATCH 2/3] Apply suggestions Signed-off-by: tison --- .github/workflows/ci.yml | 13 ++----------- .gitignore | 1 - .mvn/{ge-extensions.xml => extensions.xml} | 2 +- .mvn/gradle-enterprise.xml | 1 + 4 files changed, 4 insertions(+), 13 deletions(-) rename .mvn/{ge-extensions.xml => extensions.xml} (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fed0b3dea4..62fc4bdf2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,20 +42,11 @@ jobs: fail-fast: false matrix: java: [8, 11] + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }} steps: - uses: actions/checkout@v3 - - name: Configure Gradle Enterprise integration - run: | - if [[ -n "${{ secrets.GE_ACCESS_TOKEN }}" ]]; then - echo "Configuring Gradle Enterprise for build" - cp .mvn/ge-extensions.xml .mvn/extensions.xml - echo "GRADLE_ENTERPRISE_ACCESS_KEY=${{ secrets.GE_ACCESS_TOKEN }}" >> $GITHUB_ENV - echo "GRADLE_ENTERPRISE_ACCESS_KEY has been configured" - else - echo "GRADLE_ENTERPRISE_ACCESS_KEY is not configured." - fi - - name: Cache Local Maven Repository uses: actions/cache@v3 with: diff --git a/.gitignore b/.gitignore index d7569d413b..e263d97231 100644 --- a/.gitignore +++ b/.gitignore @@ -67,4 +67,3 @@ atlassian-ide-plugin.xml # Gradle Enterprise test-reports/ .mvn/.gradle-enterprise/ -.mvn/extensions.xml diff --git a/.mvn/ge-extensions.xml b/.mvn/extensions.xml similarity index 97% rename from .mvn/ge-extensions.xml rename to .mvn/extensions.xml index 04a32a79e7..2fa9d8d615 100644 --- a/.mvn/ge-extensions.xml +++ b/.mvn/extensions.xml @@ -24,7 +24,7 @@ com.gradle gradle-enterprise-maven-extension - 1.16.3 + 1.17 com.gradle diff --git a/.mvn/gradle-enterprise.xml b/.mvn/gradle-enterprise.xml index 9df9a64ea1..86d14f7aff 100644 --- a/.mvn/gradle-enterprise.xml +++ b/.mvn/gradle-enterprise.xml @@ -34,6 +34,7 @@ #{isFalse(env['GITHUB_ACTIONS'])} ALWAYS + true #{{'0.0.0.0'}} From 4e3113b50d8a08e87ffe0cf88cf1f22bb0eb31e8 Mon Sep 17 00:00:00 2001 From: tison Date: Sat, 6 May 2023 00:15:53 +0800 Subject: [PATCH 3/3] drop maybe-private maven command Signed-off-by: tison --- .mvn/gradle-enterprise-custom-user-data.groovy | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.mvn/gradle-enterprise-custom-user-data.groovy b/.mvn/gradle-enterprise-custom-user-data.groovy index 393a2c0108..c7ffb79f88 100644 --- a/.mvn/gradle-enterprise-custom-user-data.groovy +++ b/.mvn/gradle-enterprise-custom-user-data.groovy @@ -17,14 +17,6 @@ * under the License. */ -// Add Maven command line arguments -def mavenCommand = '' - -if (System.env.MAVEN_CMD_LINE_ARGS) { - mavenCommand = "mvn ${System.env.MAVEN_CMD_LINE_ARGS}".toString() - buildScan.value('Maven command line', mavenCommand) -} - if (System.env.GITHUB_ACTIONS) { if (session.goals.size() == 1 && session.goals[0] == 'initialize') { // omit publishing build scan when the only goal is "initialize" @@ -39,7 +31,7 @@ if (System.env.GITHUB_ACTIONS) { buildScan.link('GitHub Commit', "https://github.com/" + System.env.GITHUB_REPOSITORY + "/commits/" + System.env.GITHUB_SHA) buildScan.buildScanPublished { publishedBuildScan -> new File(System.env.GITHUB_STEP_SUMMARY).withWriterAppend { out -> - out.println("\n[Gradle build scan for '${mavenCommand}' in ${jobName}](${publishedBuildScan.buildScanUri})\n") + out.println("\n[Gradle build scan for ${jobName}](${publishedBuildScan.buildScanUri})\n") } } }