Jenkins声明性流水线,带有list-git-分支-参数-插件

fivyi3re  于 2022-09-20  发布在  Jenkins
关注(0)|答案(1)|浏览(294)

我在我的脚本中使用了listgitBranch插件,但它不能正常工作,并且我遇到了以下错误。脚本是这样的:

- script:                                                                                                                                                           
    pipelineJob('app-Build-and-Deploy') {                                                                                                                                                                                                                                       
        parameters {                                                                                                                                                  
              listGitBranches(branchFilter: '(.*)/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'BRANCH', remoteURL: 'git@git.mygit.com:app/my_app.git
        }                                                                                                                                                                                                                                                                                                                     
        definition { ...

错误:

groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.listGitBranches() is applicable for argument types: (java.util.LinkedHashMap) values: [[branchFilter:(.*)/(.*), defaultValue:master, name:BRANCH, type:BRANCH, ...]]
pbossiut

pbossiut1#

以下是正确的格式:

pipelineJob('app-Build-and-Deploy') {
              parameters {
                   listGitBranches{
                                   name('BRANCH')
                                   description('BRANCH')
                                   remoteURL('git@git.mygit.com:apps/my-app.git')
                                   credentialsId('deployer')
                                   defaultValue('master')
                                   branchFilter('(.*)/(.*)')
                                   type('BRANCH')
                                   sortMode('DESCENDING')
                                   selectedValue('TOP')
                                   tagFilter('')
                                   listSize('10')
                                   quickFilterEnabled(true)
                                }
                   }

相关问题