Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49438

I can't use selectedValue and useRepository for git parameter job-dsl-plugin

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • job-dsl-plugin
    • None
    • Dev and QA

      Hello,

      I am using a DSL groovy script to create Jenkins job of Git Parameter.

       

      DevJenkinsJobs.groovy:

      gitParam('sha') {
                  description('sha sha')
                  type('BRANCH_TAG')
                  branch('.*')
                  tagFilter('*')
                  sortMode('NONE')
                  defaultValue('master')
                  //selectedValue('NONE')
                  //useRepository('https://github.com/xxxx/xxxxxxxxx-xxx-xxxx')
                }

      The last two commented lines are failing with error.
      No signature of method: javaposse.jobdsl.dsl.helpers.GitParamContext.selectedValue() is applicable for argument types: (java.lang.String) values: [NONE]


      No signature of method: javaposse.jobdsl.dsl.helpers.GitParamContext.useRepository() is applicable for argument types: (java.lang.String)

      I cannot find much help online and found https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/GitParamContext.groovy and it seems jenkins currently support just
      String description
      String type = 'TAG'
      String branch
      String tagFilter
      String sortMode = 'NONE'
      String defaultValue

      I can't seems to be see selectedValue and useRepository. This is some what urgent to fix in our environment and your help is greatly appreciated.

          [JENKINS-49438] I can't use selectedValue and useRepository for git parameter job-dsl-plugin

          Daniel Spilker added a comment - - edited

          The Dynamic DSL supports all available options.

          job {
            parameters {
              gitParameterDefinition {
                name(String value)
                type(String value)
                defaultValue(String value)
                description(String value)
                branch(String value)
                branchFilter(String value)
                tagFilter(String value)
                sortMode(String value)
                selectedValue(String value)
                useRepository(String value)
                quickFilterEnabled(Boolean value)
              }
            }
          }
          

          Daniel Spilker added a comment - - edited The Dynamic DSL supports all available options. job { parameters { gitParameterDefinition { name( String value) type( String value) defaultValue( String value) description( String value) branch( String value) branchFilter( String value) tagFilter( String value) sortMode( String value) selectedValue( String value) useRepository( String value) quickFilterEnabled( Boolean value) } } }

          Sreeni Gadila added a comment -

          Use of gitParameterDefinition method resolved my issue.

          Sreeni Gadila added a comment - Use of gitParameterDefinition method resolved my issue.

          Nick Jones added a comment -

          It did not work for me; perhaps it is not compatible with pipelineJob? (See JENKINS-57011)

          Nick Jones added a comment - It did not work for me; perhaps it is not compatible with pipelineJob ? (See JENKINS-57011 )

            daspilker Daniel Spilker
            gadilasr Sreeni Gadila
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: