【发布时间】:2017-05-12 17:48:05
【问题描述】:
是否可以在 Jenkins 文件的 Stage 阶段定义多个条件??
让我解释一下我的问题:我只想在条件有效的情况下在我的 Jenkins 管道中发布 HTML:
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 视图中可见的“文档”。
感谢您的建议。
普里斯科
【问题讨论】:
标签: bash jenkins conditional jenkins-pipeline