diff --git a/component/BiShengJDK17/install.sh b/component/BiShengJDK17/install.sh index 97905e0fb00f16aacae79802278e82818e01796f..3aa3ad78dfdf458eb98820eb64e88585cd36b597 100644 --- a/component/BiShengJDK17/install.sh +++ b/component/BiShengJDK17/install.sh @@ -12,12 +12,13 @@ fi java_path=$(which java) if [[ ${java_path} != ${HOME}/.local/bisheng-jdk-17.0.10/bin/java ]]; then - sed -i '/bisheng-jdk-17.0.10/d' ${HOME}/.bashrc + sed -i '/bisheng-jdk-17.0.10/,+1d' ${HOME}/.bashrc echo "change ${HOME}/.bashrc" cat >> ${HOME}/.bashrc <<'EOF' export JAVA_HOME=${HOME}/.local/bisheng-jdk-17.0.10 export PATH=${JAVA_HOME}/bin:${PATH} + EOF echo "source ${HOME}/.bashrc" diff --git a/component/BiShengJDK8/install.sh b/component/BiShengJDK8/install.sh index 46062f3c21edf4efdcda6610f80593c3223e7f7a..f4bf6e92222c68eaa9ce912a0108622a65d0f29c 100644 --- a/component/BiShengJDK8/install.sh +++ b/component/BiShengJDK8/install.sh @@ -12,7 +12,7 @@ fi java_path=$(which java) if [[ ${java_path} != ${HOME}/.local/bisheng-jdk1.8.0_402/bin/java ]]; then - sed -i '/bisheng-jdk1.8.0_402/d' ${HOME}/.bashrc + sed -i '/bisheng-jdk1.8.0_402/,+3d' ${HOME}/.bashrc echo "change ${HOME}/.bashrc" cat >> ${HOME}/.bashrc <<'EOF' @@ -20,6 +20,7 @@ export JAVA_HOME=${HOME}/.local/bisheng-jdk1.8.0_402 export PATH=${JAVA_HOME}/bin:${PATH} export CLASSPATH=.:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar export JRE_HOME=${JAVA_HOME}/jre + EOF echo "source ${HOME}/.bashrc" diff --git a/tools/download_and_deploy/src/handler/generate_pipeline_script.py b/tools/download_and_deploy/src/handler/generate_pipeline_script.py index 335920bbb671d2ba9ff892494c56f1b832495b20..cf7f46db3060f1b256db1d9c047e6d47b34202f1 100644 --- a/tools/download_and_deploy/src/handler/generate_pipeline_script.py +++ b/tools/download_and_deploy/src/handler/generate_pipeline_script.py @@ -6,8 +6,13 @@ generator_class = (JenkinsScript, GitlabScript) class GeneratePipelineScript(Handler): def handle(self, data) -> bool: - for klass in generator_class: - o = klass(data) - with open("./script." + o.name, "w+", encoding="utf8") as f: - f.write(o.generate()) + try: + for klass in generator_class: + o = klass(data) + with open("./script." + o.name, "w+", encoding="utf8") as f: + f.write(o.generate()) + except Exception as e: + print("[ERROR] Generate pipeline script failed.") + return False + print("-- Generate pipeline script success. --") return True 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 34e4c4f1ede6ab942adfbb45020d0f32a07f38f2..5b09cc14391409c2820e9e2e5caa0f2f6dfe22b3 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 @@ -59,6 +59,9 @@ variables: # Devkit工具部署的环境IP DEVKIT_WEB_IP: "" + # 待病毒扫描的路径 + CLAMAV_PATH: "" + ##STAGES## """ source_migration_template = """ @@ -70,6 +73,9 @@ source-code-migration: script: - echo '====== 源码迁移 ======' - devkit porting src-mig -i ./ -c $SOURCE_CODE_COMMAND -r html || [ $? -eq 1 ] && echo 'Warning:扫描报告包含建议项' + # - devkit porting src-mig -i ./ -s interpreted -r html || [ $? -eq 1 ] && echo 'Warning:扫描报告包含建议项' + # - devkit porting src-mig -i ./ -c "${SOURCE_CODE_COMMAND}" -s asm -r html || [ $? -eq 1 ] && echo 'Warning:扫描报告包含建议项' + # - devkit porting src-mig -i ./ -s 'go' -b go -c 'go build' -r html || [ $? -eq 1 ] && echo 'Warning:扫描报告包含建议项' - mv ./src-mig*.html ./SourceCodeScanningReport.html artifacts: paths: @@ -224,7 +230,7 @@ java-performance-analysis: compatibility_test: # This job runs in the build stage, which runs first. stage: test tags: - - kunpeng_executor # 对应gitlab-runner注册时的标签,可选择多个 + - compatibility_test # 对应gitlab-runner注册时的标签,可选择多个 script: - CURDIR=$(pwd) - echo $CURDIR @@ -246,7 +252,7 @@ clamscan: - kunpeng_clamav # 对应gitlab-runner注册时的标签,可选择多个 script: - freshclam - - clamscan -i -r ./ -l ./clamscan.log + - clamscan -i -r ${CLAMAV_PATH} -l ./clamscan.log artifacts: paths: - clamscan.log 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 0c8213e6961d31a3b97d84dc44fefffc7c517758..fed3314228f7db1d9a4dca24eed8d8681e18a066 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 @@ -75,10 +75,10 @@ pipeline { BUILD_COMMAND = ''' ''' - //A-FOT配置文件存放的路径 + // A-FOT配置文件存放的路径 A_FOT_CONF_PATH = "" - //病毒扫描路径 + // 待病毒扫描的路径 CLAMAV_PATH = "" } @@ -103,7 +103,7 @@ pipeline { devkit porting src-mig -i "./${GIT_TARGET_DIR_NAME}" -c "${SOURCE_CODE_COMMAND}" -r html -o ./report_dir # devkit porting src-mig -i "./${GIT_TARGET_DIR_NAME}" -s interpreted -r html -o ./report_dir # devkit porting src-mig -i "./${GIT_TARGET_DIR_NAME}" -c "${SOURCE_CODE_COMMAND}" -s asm -r html -o ./report_dir - # devkit porting src-mig -i "./${GIT_TARGET_DIR_NAME}" -s go -r html -o ./report_dir + # devkit porting src-mig -i "./${GIT_TARGET_DIR_NAME}" -s 'go' -b go -c 'go build' -r html -o ./report_dir ''') switch(STATUS_CODE) { case 0: @@ -536,7 +536,7 @@ pipeline { // 鲲鹏兼容测试 stage('compatibility_test') { agent { - label 'kunpeng_executor' + label 'compatibility_test' } steps { script{ diff --git a/tools/download_and_deploy/src/pipeline_script_generator/script_generator_command_line.py b/tools/download_and_deploy/src/pipeline_script_generator/script_generator_command_line.py index 52973073107a16139b87b47b2aaecd041dfa63fa..dc411f1f5d533449c4f7ff7e1350d99a7780a8ee 100644 --- a/tools/download_and_deploy/src/pipeline_script_generator/script_generator_command_line.py +++ b/tools/download_and_deploy/src/pipeline_script_generator/script_generator_command_line.py @@ -11,8 +11,6 @@ class CommandLine: def add_options(cls, parser): parser.add_argument("-f", "--config", action="store", dest="yaml_path", default=DEFAULT_YAML_PATH, help="Assign yaml config file path. Default path is 'machine.yaml' in current directory.") - parser.add_argument("--debug", action="store_true", dest="debug", default=True, - help="Open debug log. Default is True.") parser.add_argument("--silent", action="store_true", dest="silent", default=False, help="Close debug log.") @classmethod