是否可以在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视图中可见。
感谢您的建议 普里斯科
答案 0 :(得分:1)
听起来你只想在@app.route('/checkAnswer', methods=['POST'])
def checkAnswer():
data = request.get_json()
if data is None:
return 'foo bar'
answer = data['answer'] if 'answer' in data else None
if answer == 1:
return 'ham'
else:
return answer
存在的情况下发布firstModule的文档。
而不是:
request.get_json()
尝试:
"${env.WORKSPACE}/firstModule/html/index.html