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

Input step doesn't output default value if not given in POST request

XMLWordPrintable

      I define an input in my pipeline with two parameters

       

      node('slave'){
          
          stage('Test'){
              def inputParameters = [
                      string(defaultValue: 'one', description: 'descr one', name: 'firstParam', trim: false),
              string(defaultValue: 'two', description: 'descr two', name: 'secondParam', trim: false)
              ];
              def result = input id: 'InputContinue', message: 'Continue ?', parameters: inputParameters;
              echo result.toString();
          }
      }
      

      If I run this job and then call the input endpoint through a POST call (not through the web interface) only giving one parameter firstParam, the value of 'result' will be a string containing the content of my firstParam parameter from the POST.

       

      If I call the POST action with two params (firstParam and secondParam), the value of 'result' will be a map of key values.

       

      I have two problems with that:

      • In the first scenario, there is no way of knowing what was the name of the parameter received by jenkins and thus mapping the value received to the correct parameter
      • The default value for parameter seems to be lost, I would expect in the first scenario to receive the value 'two' for the parameter 'secondParam'

       

            Unassigned Unassigned
            lionelraeymaekers Lionel Raeymaekers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: