From e66efab94dea390ebc747fd89a3f2c94bd656f6b Mon Sep 17 00:00:00 2001 From: Laplie Anderson Date: Thu, 10 Jul 2025 12:14:36 -0400 Subject: [PATCH 1/4] Remove submodule update as part of build --- dd-java-agent/agent-jmxfetch/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/dd-java-agent/agent-jmxfetch/build.gradle b/dd-java-agent/agent-jmxfetch/build.gradle index 1f3ae4adb9b..d1805237afe 100644 --- a/dd-java-agent/agent-jmxfetch/build.gradle +++ b/dd-java-agent/agent-jmxfetch/build.gradle @@ -97,7 +97,6 @@ tasks.register('copyMetricConfigs', CopyMetricConfigsTask) { description 'Copy metrics.yaml files from integrations-core into resources' inputDirectory = file("$projectDir/integrations-core") outputDirectory = file("$buildDir/integrations-core-resources") - dependsOn 'submodulesUpdate' } processResources { From 6d7310f1428c56672c24915c9d0438c761c945be Mon Sep 17 00:00:00 2001 From: Laplie Anderson Date: Thu, 10 Jul 2025 12:59:53 -0400 Subject: [PATCH 2/4] add GH action to update submodule --- .github/workflows/README.md | 8 +++ .../workflows/update-jmxfetch-submodule.yaml | 63 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/update-jmxfetch-submodule.yaml diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 69f9e9a6bb9..d215dfd58fc 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -130,6 +130,14 @@ _Action:_ Build the Java Client Library and runs [the system tests](https://gith _Recovery:_ Manually trigger the action on the desired branch. +### update-jmxfetch-submodule [🔗](update-jmxfetch-submodule.yaml) + +_Trigger:_ Monthly or manually + +_Action:_ Creates a PR updating the git submodule at dd-java-agent/agent-jmxfetch/integrations-core + +_Recovery:_ Manually trigger the action again. + ## Maintenance GitHub actions should be part of the [repository allowed actions to run](https://github.com/DataDog/dd-trace-java/settings/actions). diff --git a/.github/workflows/update-jmxfetch-submodule.yaml b/.github/workflows/update-jmxfetch-submodule.yaml new file mode 100644 index 00000000000..d6dc3145bf2 --- /dev/null +++ b/.github/workflows/update-jmxfetch-submodule.yaml @@ -0,0 +1,63 @@ +name: Update Docker Build Image + +on: + schedule: + - cron: '0 0 1 * *' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 + with: + submodules: 'recursive' + fetch-depth: 0 + + - name: Cache Gradle dependencies + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Update Submodule + run: | + GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" \ + JAVA_HOME=$JAVA_HOME_8_X64 \ + JAVA_8_HOME=$JAVA_HOME_8_X64 \ + JAVA_11_HOME=$JAVA_HOME_11_X64 \ + JAVA_17_HOME=$JAVA_HOME_17_X64 \ + JAVA_21_HOME=$JAVA_HOME_21_X64 \ + ./gradlew :dd-java-agent:agent-jmxfetch:submodulesUpdate + - name: Download ghcommit CLI + run: | + curl https://github.com/planetscale/ghcommit/releases/download/v0.1.48/ghcommit_linux_amd64 -o /usr/local/bin/ghcommit -L + chmod +x /usr/local/bin/ghcommit + - name: Pick a branch name + id: define-branch + run: echo "branch=ci/update-jmxfetch-submodule-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT + - name: Create branch + run: | + git checkout -b ${{ steps.define-branch.outputs.branch }} + git push -u origin ${{ steps.define-branch.outputs.branch }} --force + - name: Commit and push changes + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + run: | + ghcommit --repository ${{ github.repository }} --branch ${{ steps.define-branch.outputs.branch }} --add dd-java-agent/agent-jmxfetch/integrations-core --message "Update agent-jmxfetch submodule" + - name: Create pull request + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr create --title "Update agent-jmxfetch submodule" \ + --base master \ + --head ${{ steps.define-branch.outputs.branch }} \ + --label "comp: tooling" \ + --label "type: enhancement" \ + --label "tag: no release notes" \ + --body "This PR updates the agent-jmxfetch submodule." From 9fb2d53c078e1431950faf0ddeb43c5670d448ca Mon Sep 17 00:00:00 2001 From: Laplie Anderson Date: Thu, 10 Jul 2025 17:20:31 -0400 Subject: [PATCH 3/4] fetch submodules --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4f0e0ca785..ef27135cc58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,6 +138,8 @@ default: KUBERNETES_MEMORY_LIMIT: 8Gi CACHE_TYPE: lib #default RUNTIME_AVAILABLE_PROCESSORS_OVERRIDE: 4 # Runtime.getRuntime().availableProcessors() returns incorrect or very high values in Kubernetes + GIT_SUBMODULE_STRATEGY: normal + GIT_SUBMODULE_DEPTH: 1 cache: - key: '$CI_SERVER_VERSION-$CACHE_TYPE' # Dependencies cache. Reset the cache every time gitlab is upgraded. ~Every couple months paths: From 21a687f7a98b7f2c3e8436ffe01a6a447dc73e46 Mon Sep 17 00:00:00 2001 From: Laplie Anderson Date: Thu, 10 Jul 2025 17:29:07 -0400 Subject: [PATCH 4/4] updates with better understanding of submodule issues --- .../workflows/update-jmxfetch-submodule.yaml | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/update-jmxfetch-submodule.yaml b/.github/workflows/update-jmxfetch-submodule.yaml index d6dc3145bf2..9cd38cf906c 100644 --- a/.github/workflows/update-jmxfetch-submodule.yaml +++ b/.github/workflows/update-jmxfetch-submodule.yaml @@ -1,4 +1,4 @@ -name: Update Docker Build Image +name: Update jmxfetch integrations submodule on: schedule: @@ -11,29 +11,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 - with: - submodules: 'recursive' - fetch-depth: 0 - - - name: Cache Gradle dependencies - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - name: Update Submodule run: | - GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" \ - JAVA_HOME=$JAVA_HOME_8_X64 \ - JAVA_8_HOME=$JAVA_HOME_8_X64 \ - JAVA_11_HOME=$JAVA_HOME_11_X64 \ - JAVA_17_HOME=$JAVA_HOME_17_X64 \ - JAVA_21_HOME=$JAVA_HOME_21_X64 \ - ./gradlew :dd-java-agent:agent-jmxfetch:submodulesUpdate + git submodule update --remote -- dd-java-agent/agent-jmxfetch/integrations-core - name: Download ghcommit CLI run: | curl https://github.com/planetscale/ghcommit/releases/download/v0.1.48/ghcommit_linux_amd64 -o /usr/local/bin/ghcommit -L