是否可以在Jenkins文件的阶段阶段定义几个条件??
让我解释一下我的问题:只有在条件有效的情况下,我才想在Jenkins管道中使用publishHtml:
stage(Documentation)
{
agent any
steps
{
sh"./documents.sh " //This generate the documentation of several modules
if(firstModule) { //Is it possible to publishHTML only if documentation of this module was generated???
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: "${env.WORKSPACE}/firstModule//html",
reportFiles: 'index.html',
reportName: "Fist Module Documentation"
])
}
if(secondModule) { //Is it possible to publishHTML only if documentation of this module was generated???
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: "${env.WORKSPACE}/secondModule/html",
reportFiles: 'index.html',
reportName: "Second Modul Documentation"
])
}
}我不知道firstModule是建不造.这就是我想知道的。
我不想创建不同的阶段,而只是在jenkins视图中看到一个“文档”。
谢谢你的建议。
普里斯科
发布于 2017-05-12 23:03:34
听起来,只有在存在firstModule的情况下,才需要为"${env.WORKSPACE}/firstModule/html/index.html发布文档。
而不是:
if(firstModule) {尝试:
script {
if (fileExists("${env.WORKSPACE}/firstModule/html/index.html")) {
# publishHTML and whatnot
}
}https://stackoverflow.com/questions/43943707
复制相似问题