FrankChen021 commented on code in PR #20318:
URL: https://github.com/apache/druid/pull/20318#discussion_r3981021643


##########
.github/scripts/setup_test_profiling_env.sh:
##########
@@ -28,24 +28,34 @@ fi
 
 if [[ "$1" -ge "17" ]];
 then
-  curl https://static.imply.io/cp/$JAR_INPUT_FILE -s -o $JAR_OUTPUT_FILE
-
-  # Run 'java -version' and capture the output
-  output=$(java -version 2>&1)
-
-  # Extract the version number using grep and awk
-  jvm_version=$(echo "$output" | grep "version" | awk -F '"' '{print $2}')
-
-  shift
-  tags="${@/#/-Djfr.profiler.tags.}"
-
-  echo $ENV_VAR=-javaagent:"$PWD"/$JAR_OUTPUT_FILE \
-  -Djfr.profiler.http.username=druid-ci \
-  -Djfr.profiler.http.password=w3Fb6PW8LIo849mViEkbgA== \
-  -Djfr.profiler.tags.project=druid \
-  -Djfr.profiler.tags.jvm_version=$jvm_version \
-  "${tags[@]}"
+  # The profiler agent is observability only. If it cannot be downloaded, run 
the tests without it
+  # instead of failing the job or pointing -javaagent at a missing or partial 
jar.
+  TMP_JAR="$JAR_OUTPUT_FILE.tmp"
+  if curl -sSf --retry 3 --retry-delay 5 --retry-all-errors --connect-timeout 
15 --max-time 120 --retry-max-time 300 \
+       "https://static.imply.io/cp/$JAR_INPUT_FILE"; -o "$TMP_JAR"; then
+    mv -f "$TMP_JAR" "$JAR_OUTPUT_FILE"
+
+    # Run 'java -version' and capture the output
+    output=$(java -version 2>&1)
+
+    # Extract the version number using grep and awk
+    jvm_version=$(echo "$output" | grep "version" | awk -F '"' '{print $2}')
+
+    shift
+    tags="${@/#/-Djfr.profiler.tags.}"
+
+    echo $ENV_VAR=-javaagent:"$PWD"/$JAR_OUTPUT_FILE \
+    -Djfr.profiler.http.username=druid-ci \
+    -Djfr.profiler.http.password=w3Fb6PW8LIo849mViEkbgA== \
+    -Djfr.profiler.tags.project=druid \
+    -Djfr.profiler.tags.jvm_version=$jvm_version \
+    "${tags[@]}"
+  else
+    # stdout is appended to $GITHUB_ENV by the caller, so diagnostics must go 
to stderr.
+    echo "::warning::Failed to download the JFR profiler agent 
($JAR_INPUT_FILE); running tests without profiling" >&2
+    rm -f "$TMP_JAR" "$JAR_OUTPUT_FILE"
+    echo $ENV_VAR=\"\"
+  fi

Review Comment:
   Good catch. The root pom defaults `jfrProfilerArgLine` to an empty value, so 
the script now emits `JFR_PROFILER_ARG_LINE=` (truly empty) on both the 
download-failure path and the JDK < 17 path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to