我正在尝试在Cloudbees上使用Jenkins来自动部署软件。我按照以下步骤设置工作流程。
有时候我想重新部署。 (假设该阶段采用手动输入参数)。如何在工作流程中做到这一点?这是我的Groovy脚本。
def src = 'https://git.repo.url/proj.git'
stage 'Build'
node {
env.JAVA_HOME="${tool name: 'Pre-Installed OpenJDK 8 (Latest) on DEV@Cloud nodes', type: 'hudson.model.JDK'}"
sh 'javac -version'
git credentialsId: 'abcdef', url: src
sh 'ant -f build.xml proj.jar report'
}
stage 'Generate Release Version'
input message: 'Create Tar and Push to S3', ok: 'Generate Release'
node {
// TODO
}
stage 'QA Approved'
input message: 'Enter a Tag Name to approve this build and tag in GIT', ok: 'Approve and Tag', parameters: [[$class: 'StringParameterDefinition', defaultValue: '', description: 'Eg: Sprint73', name: 'TAG_NAME']]
node {
// TODO
}
stage 'DevOps - Ansible'
input message: 'Release to Production', ok: 'Release'
node {
// TODO
}
我尝试使用“构建管道”而不是“工作流”来使用“工作链”,以便我可以重复执行各个阶段,但这是另一个有太多工作的故事。
最佳答案
这仅在企业版Jenkins中可行。正如@ jesse-glick指出的那样,您可以在此处使用Checkpoint插件,请参见documentation。
根据CloudBees的说法,目前尚无计划在OSS版本中支持此功能。看到这个问题:JENKINS-33846
关于groovy - 如何在Jenkins Workflow中重复一个阶段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32900054/