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

Support git-parameter-plugin in declarative pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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 ?

        Attachments

          Activity

          20100 Vincent Guignot created issue -
          20100 Vincent Guignot made changes -
          Field Original Value New Value
          Description Hello,

          I'll would like to use this plugin in a declarative pipeline :
          {code:java}
           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']])
          }{code}
           

          Unfortunatly the parameter entry doesn't allow to use it :
          {code:java}
            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{code}
          I found the possibilty to use it if I put it at the begining of the script in a node :
          {code:java}
          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']])
          ])
          }
           {code}
          But is this case, it override all other parameter.

           

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

          I'll would like to use this plugin in a declarative pipeline :
          {code:java}
           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']])
          }{code}
           

          Unfortunatly the parameter entry doesn't allow to use it :
          {code:java}
            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{code}
          I found the possibilty to use it if I put it at the begining of the script in a node before the pipeline :
          {code:java}
          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']])
          ])
          }
           {code}
          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 made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          klimas7 Boguslaw Klimas made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]

            People

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

              Dates

              Created:
              Updated:
              Resolved: