---
title: Jenkins流水线示例代码
description: "示例代码如下："
url: https://www.hikunpeng.com/document/detail/zh/nativedevp/userguide/pipeline/NativeDevelopment_0096.html
sourcePath: /source/zh/nativedevp/userguide/pipeline/NativeDevelopment_0096.html
indexId: c8d3a8e9f8d8dc27227d22daca2136281aff946fc30ede1691b56945fd5ec10968
---
# Jenkins流水线示例代码

示例代码如下：

```
stage('affinity-check') {
steps {
echo '====== 构建亲和 ======'
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']
)
}
}
}
```

- 使用构建亲和功能建议放在构建流程节点前。
- “/opt/testcase/affinity/build/wtdbg2-2.5”指待分析的源码文件夹路径，请根据实际情况进行替换。
