在我的项目,我用多SCM但它depricated 我有jenkinsFile项目一个领域X ,我需要两个输入 输入1:选择项目B的领域 输入2:选择项目的分支C 我使用GitParameter插件詹金斯管道项目3个库
0
A
回答
0
0
嗨我看过git插件+ git参数插件一切都很好,但是当我想选择每个repo的分支时,它将两个存储库的所有分支重新组合在同一个参数中,猜
所以我做了一些研究,我发现这个,它的工作原理。 谢谢我的朋友对你的帮助
node() {
stage('select') {
timeout(time: 5)
{
dir("repo x") {
git branch: 'master', credentialsId: 'xxxx', url: 'ssh://xx.git'
String remoteBranchesStr = sh(script: "git branch -r", returnStdout: true).trim()
remoteBranchesStr = remoteBranchesStr.replaceAll(" ", "")
remoteBranchesStr = remoteBranchesStr.replaceAll(",", "")
remoteBranchesStr = remoteBranchesStr.replaceAll("[", "")
remoteBranchesStr = remoteBranchesStr.replaceAll("]", "")
def remoteBranches = [];
remoteBranches= remoteBranchesStr.split('origin/');
gitBranch = input(id: 'x', message: 'Sélectionner la branche x :', parameters: [[$class: 'ChoiceParameterDefinition', choices: "$remoteBranches", description: '', name: 'x : ']])
}
dir("repo y") {
git branch: 'master', credentialsId: 'yyyy', url: 'ssh://y.git'
String remoteBranchesStr = sh(script: "git branch -r", returnStdout: true).trim()
remoteBranchesStr = remoteBranchesStr.replaceAll(" ", "")
remoteBranchesStr = remoteBranchesStr.replaceAll(",", "")
remoteBranchesStr = remoteBranchesStr.replaceAll("[", "")
remoteBranchesStr = remoteBranchesStr.replaceAll("]", "")
def remoteBranches = [];
remoteBranches = remoteBranchesStr.split('origin/');
gitBranch = input(id: 'y', message: 'Sélectionner la branche y:', parameters: [[$class: 'ChoiceParameterDefinition', choices: "$remoteBranches", description: '', name: 'y: ']])
}
}
}
}
相关问题
- 1. 如何詹金斯管道
- 2. 詹金斯管道groovy.lang.MissingPropertyException
- 3. 在詹金斯管道
- 4. 限制詹金斯管道
- 5. 获取詹金斯管道
- 6. 与詹金斯管道
- 7. 詹金斯管道java.io.NotSerializableException:groovy.util.slurpersupport.NodeChildren
- 8. Perforce詹金斯多管道
- 9. 詹金斯CD管道Kubernetes
- 10. 如何在詹金斯管道Deployit配置在詹金斯
- 11. 詹金斯管道 - 如何javadoc全球管道库?
- 12. 詹金斯自由式项目和管道之间的区别
- 13. 詹金斯管道拉詹金斯文件的整个源代码
- 14. 从詹金斯管道脚本
- 15. 詹金斯管道SonarQube键名
- 16. 如何在詹金斯的Groovy管道
- 17. 坐落在詹金斯管道
- 18. 如何在管道中詹金斯
- 19. 詹金斯管道 - 找不到文件
- 20. 参数化构建 - 詹金斯管道
- 21. 搬运工詹金斯DSL管道
- 22. 从詹金斯管道执行脚本
- 23. 詹金斯2.0管道和工作DSL
- 24. 詹金斯管道常规测试
- 25. 詹金斯管道:不签代码
- 26. 詹金斯管道SH步节点
- 27. 詹金斯管道发布HTML报告
- 28. 詹金斯管道工作条件
- 29. 詹金斯管道:与管道多行shell命令
- 30. 詹金斯脚本管道或声明管道
感谢对答案安德鲁 – mouad
我的项目是不相关的 我需要的是两个参数来选择分支的基础上每个项目 – mouad