首先下在soar工具
wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.linux-amd64
#改名
mv soar.linux-amd64 soar
添加执行权限
chmod +x soar
各版本下载
- MAC OS版本 [soar.darwin-amd64](https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.darwin-amd64)
- Linux系统 [soar.linux-amd64](https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.linux-amd64)
- Windows系统 [soar.windows-amd64](https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.windows-amd64)
pipeline 脚本扫描部分
PS:
需要安装 HTML Publisher查看才能在jenkins网页显示
stage("SoarSQL"){
steps{
sh """
/usr/local/bin/soar -report-type html -query ${WORKSPACE}/sql/tables.sql > testsql.html
/usr/local/bin/soar -report-type html -query ${WORKSPACE}/sql/123.sql >> testsql.html
/usr/local/bin/soar -report-type html -query ${WORKSPACE}/sql/v1.0.sql >> testsql.html
"""
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'testsql.html', reportName: 'SQLreport', reportTitles: ''])
}
}
进入后