From 94d7e0dffcdc62fa13e4a0edd3fb73c2b9680c36 Mon Sep 17 00:00:00 2001 From: cleverchuk Date: Tue, 16 Dec 2025 12:47:26 -0500 Subject: [PATCH] add duplicate check and bump joboe --- .github/scripts/detect-duplicate-classes.sh | 48 +++++++++++++++++++++ .github/workflows/push.yml | 19 +++++++- dependencyManagement/build.gradle.kts | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100755 .github/scripts/detect-duplicate-classes.sh diff --git a/.github/scripts/detect-duplicate-classes.sh b/.github/scripts/detect-duplicate-classes.sh new file mode 100755 index 00000000..ae050e5b --- /dev/null +++ b/.github/scripts/detect-duplicate-classes.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Script to detect duplicate classes in a JAR file +# Usage: ./detect-duplicate-classes.sh + +set -euo pipefail + +if [ $# -ne 1 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +JAR_FILE="$1" + +if [ ! -f "$JAR_FILE" ]; then + echo "Error: File '$JAR_FILE' not found" >&2 + exit 1 +fi + +echo "Analyzing JAR: $JAR_FILE" +echo "Searching for duplicate classes..." +echo "" + +jar tf "$JAR_FILE" | grep '\.class$' | sort > /tmp/classes.txt + +DUPLICATES=$(awk '{ + full_path = $0 + count[full_path]++ +} +END { + found = 0 + for (path in count) { + if (count[path] > 1) { + if (found == 0) found = 1 + print path " (appears " count[path] " times)" + } + } + if (found == 0) print "" +}' /tmp/classes.txt) + +if [ -z "$DUPLICATES" ]; then + echo "✓ No duplicate classes found" +else + echo "✗ Duplicate classes detected:" + echo "" + echo "$DUPLICATES" + exit 1 +fi diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index be5b2b02..8f117048 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -670,4 +670,21 @@ jobs: - name: Upload SARIF result uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: sarif.output.json \ No newline at end of file + sarif_file: sarif.output.json + + duplicate-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Set up JDK 17 + uses: actions/setup-java@v5 + with: + java-version: '17' + distribution: 'temurin' + + - name: Check duplicated class + run: | + ./gradlew build -x test + .github/scripts/detect-duplicate-classes.sh agent/build/libs/solarwinds-apm-agent.jar + .github/scripts/detect-duplicate-classes.sh agent-lambda/build/libs/solarwinds-apm-agent-lambda.jar \ No newline at end of file diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index e71926e5..5e4e9261 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -7,7 +7,7 @@ val otelSdkVersion = "1.56.0" val mockitoVersion = "4.11.0" val byteBuddyVersion = "1.15.10" -val joboeVersion = "10.0.26" +val joboeVersion = "10.0.27" val opentelemetryJavaagentAlpha = "$otelAgentVersion-alpha" val opentelemetryAlpha = "$otelSdkVersion-alpha"