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

no parameter type in Jenkinsfile for “List Subversion tags (and more)”

      It doesn't seem possible to define a parameter of type “List Subversion tags (and more)” in a (declarative) pipeline script. The parameter type is available in the Web GUI and works as expected when starting a job. I want to define all parameters in the Jenkinsfile which is stored in SVN instead of using the Web GUI for every job.

      In https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-parameters or https://www.jenkins.io/doc/book/pipeline/syntax/#parameters there is no documentation of the syntax for a parameter of this type.

      Despite the missing documentation I tried to add such a parameter using strings from the source code of the subversion plugin and checked the code with the Jenkins linter. A line like

      listSubversionTags(name: 'PARAM_SVN_BRANCH', tagsDir: 'https://server/svn/path/to/repo/base', credentialsId: '12345678-9abc-def0-1234-56789abcdef0', defaultValue: 'trunk', reverseByDate: true)

      results in an error message which lists the possible parameter types

      WorkflowScript: 9: Invalid parameter type listSubversionTags. Valid parameter types: [booleanParam, buildSelector, choice, credentials, file, text, separator, password, persistentBoolean, persistentChoice, persistentString, persistentText, run, string] @ line {{9, column 6.}}

      The list of parameter types corresponds to the parameter type selection in the Web GUI, with the exception that a type for “List Subversion tags (and more)” is missing between file and text.

      Boolean Parameter (= booleanParam)

      File Parameter (= file)
      List Subversion tags (and more) (missing here)
      Multi-line String Parameter (= text)

      String Parameter (= string)

       

      This might mean that the parameter type “List Subversion tags (and more)” is not available in a pipeline script.

      Is this a bug or missing feature of the subversion plugin?
      Is there a way to define a parameter of this type in a (declarative) pipeline script?

          [JENKINS-69392] no parameter type in Jenkinsfile for “List Subversion tags (and more)”

          mesa added a comment -

          Same issue here, asking the same questions!

          mesa added a comment - Same issue here, asking the same questions!

          Bodo . added a comment -

          A co-worker suggested a work-around: In a scripted style parameters definition it is possible to define the parameter provided by the SVN plugin. It is possible to combine this with a declarative style pipeline specification.

          By replacing the declarative style parameters definition inside {{pipeline { ... }}} with a definition in scripted pipeline style after {{pipeline { ... }}} I was able to define the "List Subversion tags (and more)" parameter.

          Example:

          Instead of a

          pipeline {
              agent any // Run on any agent
              parameters {
                 separator name: 'sep1', sectionHeader: 'first heading'
                 string name: 'SVN_REVISION', defaultValue: 'HEAD', description: 'Specify SVN revision or leave default value "HEAD".'
                 separator name: 'sep2', sectionHeader: 'second heading'
                 choice name: 'PARAM_CHOICE', choices: ['NO', 'YES', 'MAYBE'], description: '''Select something:
          [explanation of the values]'''
                 separator name: 'sep3', sectionHeader: 'third heading'
                 text name: 'PARAM_TEXT', description: 'Description of this text parameter'
          {{    }}}
          // ...
          }

          I use

          pipeline {
              agent any // Run on any agent
          // ...
          }
          properties([
             parameters([
                separator( name: 'sep1', sectionHeader: 'first heading' ),
                // Parameter type "List Subversion tags (and more)" in web GUI
                [ $class         :  'ListSubversionTagsParameterDefinition',
                  name           :  'SVN_BRANCH',
                  defaultValue   :  'trunk',
                  tagsDir        :  'https://servername/svn/path/to/svn_repo',
                  credentialsId  :  '12345678-9abc-def0-1234-56789abcdef0',
                  reverseByDate  :  true
                ],
                string( name: 'SVN_REVISION', defaultValue: 'HEAD', description: 'Specify SVN revision or leave default value "HEAD".' ),
                separator( name: 'sep2', sectionHeader: 'Commit build results' ),
                choice( name: 'PARAM_CHOICE', choices: ['NO', 'YES', 'MAYBE'], description: '''Select something:
          [explanation of the values]''' ),
                separator( name: 'sep3', sectionHeader: 'third heading' ),
                text( name: 'PARAM_TEXT', description: 'Description of this text parameter' )
             ])
          ])

          (untested modification of my real code)

           

          Bodo . added a comment - A co-worker suggested a work-around: In a scripted style parameters definition it is possible to define the parameter provided by the SVN plugin. It is possible to combine this with a declarative style pipeline specification. By replacing the declarative style parameters definition inside {{pipeline { ... }}} with a definition in scripted pipeline style after {{pipeline { ... }}} I was able to define the "List Subversion tags (and more)" parameter. Example: Instead of a pipeline {     agent any // Run on any agent     parameters {        separator name: 'sep1', sectionHeader: 'first heading'        string name: 'SVN_REVISION', defaultValue: 'HEAD', description: 'Specify SVN revision or leave default value "HEAD".'        separator name: 'sep2', sectionHeader: 'second heading'        choice name: 'PARAM_CHOICE', choices: ['NO', 'YES', 'MAYBE'] , description: '''Select something: [explanation of the values] '''        separator name: 'sep3', sectionHeader: 'third heading'        text name: 'PARAM_TEXT', description: 'Description of this text parameter' {{    }}} // ... } I use pipeline {     agent any // Run on any agent // . .. } properties([    parameters([       separator( name: 'sep1', sectionHeader: 'first heading' ),       // Parameter type "List Subversion tags (and more)" in web GUI       [ $class         :  'ListSubversionTagsParameterDefinition',         name           :  'SVN_BRANCH',         defaultValue   :  'trunk',         tagsDir        :  'https://servername/svn/path/to/svn_repo',         credentialsId  :  '12345678-9abc-def0-1234-56789abcdef0',         reverseByDate  :  true       ],       string( name: 'SVN_REVISION', defaultValue: 'HEAD', description: 'Specify SVN revision or leave default value "HEAD".' ),       separator( name: 'sep2', sectionHeader: 'Commit build results' ),       choice( name: 'PARAM_CHOICE', choices: ['NO', 'YES', 'MAYBE'] , description: '''Select something: [explanation of the values] ''' ),       separator( name: 'sep3', sectionHeader: 'third heading' ),       text( name: 'PARAM_TEXT', description: 'Description of this text parameter' )    ]) ]) (untested modification of my real code)  

            Unassigned Unassigned
            bomm Bodo .
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: