Jenkins Pipeline中集成测试工具,请确保运行的用户拥有root权限。
pipeline { agent any options { timeout(time: 1, unit: 'HOURS') } parameters { string(name: 'GIT_URL', defaultValue: 'https://github.com/ruanjue/wtdbg2.git', description: '--> git url <--') string(name: 'GIT_BRANCH', defaultValue: 'v2.5', description: '--> code branch <--') string(name: 'GIT_TARGET_DIR_NAME', defaultValue: 'wtdbg2', description: '--> code branch <--') } stages{ stage('Git Code') { steps { agent { label 'kunpeng_scanner' //对应添加节点时的标签,可选择多个 } echo '====== 获取源码 ======' checkout scmGit(branches: [[name: "${params.GIT_BRANCH}"]], browser: github("${params.GIT_URL}"), extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.GIT_TARGET_DIR_NAME}"], cleanBeforeCheckout(deleteUntrackedNestedRepositories: true)], userRemoteConfigs: [[url: "${params.GIT_URL}"]]) } } stage('compatibility testing') { agent { label 'kunpeng_compatibility' } steps { script{ echo '====== compatibility testing ======' sh ''' CURDIR=$(pwd) /bin/cp -rf /root/.local/compatibility_testing/template.html.bak /root/.local/compatibility_testing/template.html sudo /bin/bash /root/.local/compatibility_testing/bin/compatibility_test//若为root用户执行,请去掉“sudo”命令 /bin/cp -rf /root/.local/compatibility_testing/compatibility_report.html $CURDIR ''' } } post { always { publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: false, keepAll : true, reportDir : '.', reportFiles : 'compatibility_report.html', reportName : 'compatibility test Report'] ) } } } } }