Rate This Document
Findability
Accuracy
Completeness
Readability

Jenkins Pipeline Sample Code

The sample code is as follows:

stage('affinity-check') {
        steps {
            echo '====== Build affinity check======'
            sh '''
            if [ ! -d "./report_dir" ]; then mkdir -p ./report_dir; fi
            /usr/bin/rm -rf ./report_dir/*.html
            devkit advisor affi-check -i /opt/testcase/affinity/build/wtdbg2-2.5 -c make -r html -o ./report_dir
            mv ./report_dir/affi-check*.html ./report_dir/affinity-check.html
            '''
        }
        post {
            always {
                publishHTML(target: [allowMissing: false,
                            alwaysLinkToLastBuild: false,
                            keepAll              : true,
                            reportDir            : './report_dir',
                            reportFiles          : 'affinity-check.html',
                            reportName           : 'affinity-check Report']
                            )
            }
        }
}
  • You are advised to perform the build affinity check before the build process.
  • /opt/testcase/affinity/build/wtdbg2-2.5 indicates the path to the source code folder to be analyzed. Replace it with the actual path.