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

Support git-parameter-plugin in declarative pipeline

XMLWordPrintable

      Hello,

      I'll would like to use this plugin in a declarative pipeline :

       pipeline { 
          agent {
      	    dockerfile {(...)
      		}
      	}
      	options {
      		timestamps()
      		//Jobs properties
      		buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'))
      		disableConcurrentBuilds()
      	}	parameters {
      		string(defaultValue: '', description: 'Refs to build', name: 'ref')
          	booleanParam(defaultValue: false, description: 'Release mode', name: 'release')
          	string(defaultValue: '', description: 'Qualifier to use in release mode only.', name: 'qualifier', trim: true)
          	parameters([[$class: 'GitParameterDefinition', branch: '', branchFilter: '.*', defaultValue: '', description: 'Tag to choosen', listSize: '0', name: 'tag', quickFilterEnabled: false, selectedValue: 'NONE', sortMode: 'NONE', tagFilter: '*', type: 'PT_TAG']])
      	}

       

      Unfortunatly the parameter entry doesn't allow to use it :

        Valid parameter types: [booleanParam, choice, credentials, file, text, password, run, string] @ line 42, column 7.
             	 parameters([[$class: 'GitParameterDefinition', branch: '', branchFilter: '.*', defaultValue: '', description: 'Tag to choosen', listSize: '0', name: 'tag', quickFilterEnabled: false, selectedValue: 'NONE', sortMode: 'NONE', tagFilter: '*', type: 'PT_TAG']])
               ^1 error

      I found the possibilty to use it if I put it at the begining of the script in a node before the pipeline :

      node {
      	properties([
          parameters([[$class: 'GitParameterDefinition', branch: '', branchFilter: '.*', defaultValue: '', description: 'Tag to choosen', listSize: '0', name: 'tag', quickFilterEnabled: false, selectedValue: 'NONE', sortMode: 'NONE', tagFilter: '*', type: 'PT_TAG']])
      ])
      }
       

      But is this case, it override all others parameters.

       

      So is it possible to add the support of git-parameter-plugin directly inside the parameters closure  like string, boolean, etc ?

            klimas7 Boguslaw Klimas
            20100 Vincent Guignot
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: