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

Item.getParams() always returns empty string in pipeline

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Incomplete
    • Component/s: core
    • Labels:
      None
    • Environment:
      Jenkins 2.77
    • Similar Issues:

      Description

      I'm trying to define some parameters in jenkins pipeline, and I can specify the parameters for each build. Then I try to access parameters for items in jenkins Queue, but I always got nothing. Here is my jenkins file:

       

      node {
          // adds job parameters within jenkinsfile
              properties([
                 parameters([
                     booleanParam(
                     defaultValue: false,
                     description: 'isFoo should be false',
                     name: 'isFoo'
                     ),
                     booleanParam(
                     defaultValue: true,
                     description: 'isBar should be true',
                     name: 'isBar'
                   ),
                 ])
               ])
      
          stage("Show items in queue") {
              def q = Jenkins.instance.queue
              echo "There are ${q.items.length} items in queue"
              q.items.each {
                  echo "task ${it.task.name}"
                  echo "${it.params}"
              }
          }
      }

      And output:

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              liketic Li Ke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: