我正在Jenkins管道上创建一个职位,以使用junit,html和cobertura发布测试结果。代码看起来像这样
post {
always {
publishTestResults(
script: this,
junit: [
active:true,
allowEmptyResults:true,
archive: true,
pattern: '**/reports/mocha.xml',
updateResults: true
],
cobertura: [
active:true,
allowEmptyResults:true,
archive:true,
pattern: '**/coverage/cobertura/cobertura-coverage.xml'
],
html: [
active:true,
allowEmptyResults:true,
archive:true,
name: 'NYC/Mocha',
path: '**/coverage/html'
],
lcov: [
active:true,
allowEmptyResults:true,
archive:true,
name: 'LCOV Coverage',
path: '**/coverage/lcov/lcov-report'
]
)
cobertura coberturaReportFile: 'coverage/cobertura/cobertura-coverage.xml'
junit 'reports/mocha.xml'
cleanWs()
// deleteDir()
script {
FAILED_STAGE = env.STAGE_NAME
}
}
}
}
问题是,当我在詹金斯上执行作业时,我收到一条错误消息:
find . -wholename **/reports/mocha.xml -exec touch {} ;
touch: cannot touch './reports/mocha.xml': Permission denied
我猜想junit命令引起的问题。我该如何解决这个问题?
P / S:Jenkins服务器在Ubuntu上运行。我试图修改/ etc / sudoers并添加此行以使Jenkins以root身份执行命令。它仍然无法解决我的问题。
jenkins ALL=(ALL) NOPASSWD: ALL
答案 0 :(得分:0)
看起来您可以通过将updateResults
设置为false
如果绝对必须更新结果文件上的时间戳,则必须打开终端会话,转到项目工作区(使用jenkins用户)并尝试运行touch ./reports/mocha.xml
,然后从中调试在那里。