xOU*_*OUe 5 git groovy jenkins jenkins-pipeline
我正在尝试在Jenkins(2.19.4)中获取参数化管道作业以使用以下规范:
BRANCH_TO_BUILD Git参数,用于从gitlab存储库中检索所有可用分支,供用户选择一个我得到的错误与Git参数有关:
net.uaznia.lukanus.hudson.plugins.gitparameter.jobs.WorkflowJobWrapper getSCMFromDefinition
SEVERE: Get repo scm from Workflow job fail
java.lang.NoSuchMethodException: org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition.getScm()
Run Code Online (Sandbox Code Playgroud)
据我所知,Jenkins在请求参数输入之前无法从管道脚本中检索SCM配置.
我知道有一个新的功能请求JENKINS-39530,但有不同的方法来实现这一目标吗?
据我了解,您想要一份用户选择分支的工作。分支应与 GitLab 中的分支保持同步。
一种方法是使用Job DSL 插件。
作业 DSL 看起来与此类似:
...
pipelineJob("the pipeline job") {
parameters {
def branches = ['[Choose]']
getJson(server+ "/rest/request/to/gitlab...")
.values
.each { branch ->
if (branch.displayId.startsWith('feature')) {
branches.push(branch.displayId)
}
}
choiceParam(
'branch',
branches,
'Pick a branch.')
}
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2712 次 |
| 最近记录: |