admin管理员组文章数量:1122832
I have a CI pipeline which is triggered whenever a user creates a merge request. In addition, I can run it on a specific branch that I give as a parameter. I then checkout the branch and run the unit tests/E2E tests on it.
givenGitBranch = user decides to run tests on a specific branch
gitlabSourceBranch = branch of the merge request
stage('Checkout branch') {
steps {
updateGitlabCommitStatus name: 'build', state: 'running'
cleanWs()
echo "Given Git Branch: ${params.givenGitBranch}"
echo "GitLab Source Branch: ${env.gitlabSourceBranch}"
checkout([
$class: 'GitSCM',
branches: [([ $class: 'BranchSpec',
name: params.givenGitBranch ?: env.gitlabSourceBranch])],
userRemoteConfigs: [[url: scm.getUserRemoteConfigs()[0].getUrl(),
credentialsId:'random-creds']]
])
}
}
However, when I want to rerun a failed pipeline via Blue Ocean, the parameters are initialized as null and this stage fails. Is there a way to access the parameter values when I rerun the pipeline?
I tried reviewing Jenkins docs, pipeline options and nothing was relevant to the solution.
I have a CI pipeline which is triggered whenever a user creates a merge request. In addition, I can run it on a specific branch that I give as a parameter. I then checkout the branch and run the unit tests/E2E tests on it.
givenGitBranch = user decides to run tests on a specific branch
gitlabSourceBranch = branch of the merge request
stage('Checkout branch') {
steps {
updateGitlabCommitStatus name: 'build', state: 'running'
cleanWs()
echo "Given Git Branch: ${params.givenGitBranch}"
echo "GitLab Source Branch: ${env.gitlabSourceBranch}"
checkout([
$class: 'GitSCM',
branches: [([ $class: 'BranchSpec',
name: params.givenGitBranch ?: env.gitlabSourceBranch])],
userRemoteConfigs: [[url: scm.getUserRemoteConfigs()[0].getUrl(),
credentialsId:'random-creds']]
])
}
}
However, when I want to rerun a failed pipeline via Blue Ocean, the parameters are initialized as null and this stage fails. Is there a way to access the parameter values when I rerun the pipeline?
I tried reviewing Jenkins docs, pipeline options and nothing was relevant to the solution.
Share Improve this question edited yesterday Omer Lerner asked yesterday Omer LernerOmer Lerner 112 bronze badges New contributor Omer Lerner is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.1 Answer
Reset to default 0- I don't suggest blue ocean anymore since they are no longer maintained. The graph view plugin is all you need for a lightweight graph view.
- The rerun button is actually treated as 'replay' when you wanted the 'rebuild' button instead.
- In the normal view, a rebuild should fill the parameters (applies the env as well). As long as you expose the parameters in the first place.
Hope that helps
本文标签: cicdRerun Jenkins Pipeline with parameters from the last buildStack Overflow
版权声明:本文标题:cicd - Rerun Jenkins Pipeline with parameters from the last build - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736281312a1926280.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论