From a825649ed577fb21ca2dbce843e9708400aaf156 Mon Sep 17 00:00:00 2001 From: pan <601760354@163.com> Date: Fri, 14 Jun 2024 10:07:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0java=20perf=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitlab_generator.py | 22 ++++++++++++-- .../jenkins_generator.py | 30 +++++++++++++++++++ .../script_generator.py | 1 + 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py b/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py index 78571e8..9f44340 100644 --- a/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py +++ b/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py @@ -200,7 +200,25 @@ A-FOT: - export PATH=${HOME}/.local/gcc-10.3.1-2023.12-aarch64-linux/bin:$PATH - a-fot --config_file $A_FOT_CONF_PATH/a-fot.ini """ - java_perf_template = "" + java_perf_template = """ +# java性能调优 +java-performance-analysis: + stage: test + tags: + - kunpeng_tester # 对应gitlab-runner注册时的标签,可选择多个 + script: + - /usr/bin/rm -rf ./report_dir/*.html + - set -e + - CURDIR=$(pwd) + # 删除上次jmeter产生的报告 (jmeter 命令-l、-o指定的文件和路径) + - rm -rf ${JAVA_JMETER_RESULT_FILE_NAME} ${JAVA_JMETER_RESULT_REPORT_DIR} + # 运行java性能采集 + - ${HOME}/.local/devkit_tester/bin/entrance -i ${TARGET_SERVER_IP} -u root -f ${HOME}/.ssh/id_rsa -D ${DEVKIT_WEB_IP} -a ${JAVA_APPLICATION_NAME} -d ${JAVA_COLLECTION_APPLICATION_DURATION} -g ./${GIT_TARGET_DIR_NAME} -j 'sh ${JAVA_JMETER_COMMAND}' -o ./ + artifacts: + paths: + - devkit_performance_report.html + name: Java_Performance_Report +""" compatibility_test_template = """ # 鲲鹏兼容测试 compatibility_test: # This job runs in the build stage, which runs first. @@ -223,7 +241,7 @@ compatibility_test: # This job runs in the build stage, which runs first. clamav_template = """ # 病毒扫描 clamscan: - stage: build + stage: clamav tags: - kunpeng_clamav # 对应gitlab-runner注册时的标签,可选择多个 script: diff --git a/tools/download_and_deploy/src/pipeline_script_generator/jenkins_generator.py b/tools/download_and_deploy/src/pipeline_script_generator/jenkins_generator.py index 6183724..d976d74 100644 --- a/tools/download_and_deploy/src/pipeline_script_generator/jenkins_generator.py +++ b/tools/download_and_deploy/src/pipeline_script_generator/jenkins_generator.py @@ -502,6 +502,36 @@ pipeline { } """ java_perf_template = """ + // java性能调优 + stage('java-performance-analysis') { + agent { + label 'kunpeng_tester' + } + steps { + echo '====== Java Performance Analysis ======' + sh ''' + /usr/bin/rm -rf ./report_dir/*.html + # 设置当返回不为0时 停止下一步,直接返回 + set -e + CURDIR=$(pwd) + # 删除上次jmeter产生的报告 (jmeter 命令-l、-o指定的文件和路径) + rm -rf "${JAVA_JMETER_RESULT_FILE_NAME}" "${JAVA_JMETER_RESULT_REPORT_DIR}" + # 运行java性能采集 + ${HOME}/.local/devkit_tester/bin/entrance -i "${TARGET_SERVER_IP}" -u root -f ${HOME}/.ssh/id_rsa -D "${DEVKIT_WEB_IP}" -a "${JAVA_APPLICATION_NAME}" -d "${JAVA_COLLECTION_APPLICATION_DURATION}" -g "./${GIT_TARGET_DIR_NAME}" -j 'sh "${JAVA_JMETER_COMMAND}"' -o ./report_dir + ''' + } + post { + always { + publishHTML(target: [allowMissing: false, + alwaysLinkToLastBuild: false, + keepAll : true, + reportDir : './report_dir', + reportFiles : 'devkit_performance_report.html', + reportName : 'Java Performance Report'] + ) + } + } + } """ compatibility_test_template = """ diff --git a/tools/download_and_deploy/src/pipeline_script_generator/script_generator.py b/tools/download_and_deploy/src/pipeline_script_generator/script_generator.py index 83a434f..77835ea 100644 --- a/tools/download_and_deploy/src/pipeline_script_generator/script_generator.py +++ b/tools/download_and_deploy/src/pipeline_script_generator/script_generator.py @@ -36,6 +36,7 @@ class ScriptGenerator: JAVA_BUILDER_JDK8: [self.java8_build_template], JAVA_BUILDER_JDK17: [self.java17_build_template], COMPATIBILITY: [self.compatibility_test_template], + TESTER: [self.java_perf_template], CLAMAV: [self.clamav_template] } -- Gitee From f4b72aff6c4f5eea84d51a2397f212c8d9462460 Mon Sep 17 00:00:00 2001 From: openeuler <2965713873@qq.com> Date: Fri, 14 Jun 2024 07:28:06 +0000 Subject: [PATCH 2/2] update tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py. Signed-off-by: openeuler <2965713873@qq.com> --- .../pipeline_script_generator/gitlab_generator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py b/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py index 9f44340..3149a39 100644 --- a/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py +++ b/tools/download_and_deploy/src/pipeline_script_generator/gitlab_generator.py @@ -41,7 +41,7 @@ variables: # 编译命令 BUILD_COMMAND: "" # A-FOT配置文件存放路径 - A_FOT_CONF_PATH: "" + A_FOT_CONF_PATH: "" # Java Performance Analysis功能参数 # 需要采集的目标程序所在的服务器地址, 多个使用逗号隔离 @@ -164,7 +164,7 @@ build: - $BUILD_COMMAND """ bisheng_compiler_template = """ -# 普通编译 +# 使用毕昇编译器编译 build: stage: build tags: @@ -228,10 +228,10 @@ compatibility_test: # This job runs in the build stage, which runs first. script: - CURDIR=$(pwd) - echo $CURDIR - - /bin/cp -rf /root/.local/compatibility_testing/template.html.bak /root/.local/compatibility_testing/template.html - - /bin/bash compatibility_test - - /bin/cp -rf /root/.local/compatibility_testing/compatibility_report.html $CURDIR/compatibility_report.html - - sudo /bin/bash /root/.local/compatibility_testing/report_result.sh + - cp -rf ${HOME}/.local/compatibility_testing/template.html.bak ${HOME}/.local/compatibility_testing/template.html + - ${HOME}/.local/compatibility_testing/bin/compatibility_test + - cp -rf ${HOME}/.local/compatibility_testing/compatibility_report.html $CURDIR/compatibility_report.html + - sudo /bin/bash ${HOME}/.local/compatibility_testing/report_result.sh - echo "请去 '${CURDIR}'/compatibility_report.html 查看报告 " artifacts: paths: @@ -245,6 +245,7 @@ clamscan: tags: - kunpeng_clamav # 对应gitlab-runner注册时的标签,可选择多个 script: + - freshclam - clamscan -i -r ./ -l ./clamscan.log artifacts: paths: -- Gitee