From c8357762e4f44812371c53c4396c0ad99cf01ec4 Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Mon, 5 Aug 2024 13:02:55 -0700 Subject: [PATCH] Make benchmark results comment on pull request collapsable (#4914) Signed-off-by: Rishabh Singh --- jenkins/opensearch/benchmark-pull-request.jenkinsfile | 9 ++++++++- .../benchmark-pull-request-generic.jenkinsfile.txt | 9 ++++++++- .../benchmark-pull-request-user.jenkinsfile.txt | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/jenkins/opensearch/benchmark-pull-request.jenkinsfile b/jenkins/opensearch/benchmark-pull-request.jenkinsfile index ea161ec14c..a22829afa1 100644 --- a/jenkins/opensearch/benchmark-pull-request.jenkinsfile +++ b/jenkins/opensearch/benchmark-pull-request.jenkinsfile @@ -267,7 +267,14 @@ pipeline { } post { success { - sh "sed -i '1i\\#### Benchmark Results for Job: ${BUILD_URL}' final_result_${BUILD_NUMBER}.md" + sh """ + echo '
Benchmark Results' > temp_result_${BUILD_NUMBER}.md + echo '' >> temp_result_${BUILD_NUMBER}.md + echo '#### Benchmark Results for Job: ${BUILD_URL}' >> temp_result_${BUILD_NUMBER}.md + cat final_result_${BUILD_NUMBER}.md >> temp_result_${BUILD_NUMBER}.md + echo '
' >> temp_result_${BUILD_NUMBER}.md + mv temp_result_${BUILD_NUMBER}.md final_result_${BUILD_NUMBER}.md + """ script { if (currentBuild.rawBuild.getCauses().toString().contains("GenericCause")) { withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-generic.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-generic.jenkinsfile.txt index 44a75e45c6..80efb53e50 100644 --- a/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-generic.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-generic.jenkinsfile.txt @@ -52,7 +52,14 @@ runBenchmarkTestScript.writeFile({file=/tmp/workspace/benchmark.ini, text=}) runBenchmarkTestScript.sh(set +x && ./test.sh benchmark-test --distribution-url https://artifacts.com/artifact.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false --without-security --single-node --min-distribution --use-50-percent-heap --suffix 307 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --data-node-storage 100) benchmark-pull-request.sh(cp /tmp/final_result_307.md final_result_307.md) - benchmark-pull-request.sh(sed -i '1i\#### Benchmark Results for Job: test://artifact.url' final_result_307.md) + benchmark-pull-request.sh( + echo '
Benchmark Results' > temp_result_307.md + echo '' >> temp_result_307.md + echo '#### Benchmark Results for Job: test://artifact.url' >> temp_result_307.md + cat final_result_307.md >> temp_result_307.md + echo '
' >> temp_result_307.md + mv temp_result_307.md final_result_307.md + ) benchmark-pull-request.script(groovy.lang.Closure) benchmark-pull-request.usernamePassword({credentialsId=jenkins-github-bot-token, passwordVariable=GITHUB_TOKEN, usernameVariable=GITHUB_USER}) benchmark-pull-request.withCredentials([[GITHUB_USER, GITHUB_TOKEN]], groovy.lang.Closure) diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-user.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-user.jenkinsfile.txt index 611a0305d1..927fb2d66c 100644 --- a/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-user.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch/benchmark-pull-request-user.jenkinsfile.txt @@ -52,7 +52,14 @@ runBenchmarkTestScript.writeFile({file=/tmp/workspace/benchmark.ini, text=}) runBenchmarkTestScript.sh(set +x && ./test.sh benchmark-test --distribution-url https://artifacts.com/artifact.tar.gz --distribution-version 3.0.0 --config /tmp/workspace/config.yml --workload nyc-taxis --benchmark-config /tmp/workspace/benchmark.ini --user-tag run-type:test,security-enabled:false --without-security --single-node --min-distribution --use-50-percent-heap --suffix 307 --data-instance-type r5-4xlarge --test-procedure append-no-conflicts --data-node-storage 100) benchmark-pull-request.sh(cp /tmp/final_result_307.md final_result_307.md) - benchmark-pull-request.sh(sed -i '1i\#### Benchmark Results for Job: test://artifact.url' final_result_307.md) + benchmark-pull-request.sh( + echo '
Benchmark Results' > temp_result_307.md + echo '' >> temp_result_307.md + echo '#### Benchmark Results for Job: test://artifact.url' >> temp_result_307.md + cat final_result_307.md >> temp_result_307.md + echo '
' >> temp_result_307.md + mv temp_result_307.md final_result_307.md + ) benchmark-pull-request.script(groovy.lang.Closure) benchmark-pull-request.postCleanup() postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true})