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

Not able to set password parameter's default value from shared library

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • workflow-cps-plugin
    • None

      When setting a default value for a password parameter from shared library code, we get the warning "Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue" in the build log .

      As an example, the Jenkinsfile: 

      #!/usr/bin/env groovy @Library('<git-branch-name>')_ 
      passwordUse()
      

      shared library, vars/passwordUse.groovy: 

      def call() {
          stage('Show parameters') {
              echo "test_password : " + params.test_password
          }
          stage('Add password parameter') {
              properties([
                      parameters([
                              password(name: 'test_password', defaultValue: 'default_password', description: 'test password')
                      ])
              ])
          }
      }
      

      The warning in the build log: 

      [Pipeline] stage
      [Pipeline] { (Add password parameter)
      [Pipeline] properties (hide)
      WARNING: Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue
      [Pipeline] }
      [Pipeline] // stage
      

          [JENKINS-64283] Not able to set password parameter's default value from shared library

          Konstantin Shipkov created issue -
          Konstantin Shipkov made changes -
          Description Original: When setting a default value for a password parameter from shared library code, we get the warning "_Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue_" in the build log .

          As an example, the Jenkinsfile:

           
          {code:java}
          #!/usr/bin/env groovy @Library('<git-branch-name>')_ passwordUse()
          {code}
          shared library, vars/passwordUse.groovy:

           

           
          {code:java}
          def call() {
              stage('Show parameters') {
                  echo "test_password : " + params.test_password
              }
              stage('Add password parameter') {
                  properties([
                          parameters([
                                  password(name: 'test_password', defaultValue: 'default_password', description: 'test password')
                          ])
                  ])
              }
          }
          {code}
          The warning in the build log:

           

           
          {code:java}
          [Pipeline] stage
          [Pipeline] { (Add password parameter)
          [Pipeline] properties (hide)
          WARNING: Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue
          [Pipeline] }
          [Pipeline] // stage
          {code}
           

           

           

           
          New: When setting a default value for a password parameter from shared library code, we get the warning "_Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue_" in the build log .

          As an example, the Jenkinsfile:

           
          {code:java}
          #!/usr/bin/env groovy @Library('<git-branch-name>')_
          passwordUse()
          {code}
          shared library, vars/passwordUse.groovy:

           

           
          {code:java}
          def call() {
              stage('Show parameters') {
                  echo "test_password : " + params.test_password
              }
              stage('Add password parameter') {
                  properties([
                          parameters([
                                  password(name: 'test_password', defaultValue: 'default_password', description: 'test password')
                          ])
                  ])
              }
          }
          {code}
          The warning in the build log:

           

           
          {code:java}
          [Pipeline] stage
          [Pipeline] { (Add password parameter)
          [Pipeline] properties (hide)
          WARNING: Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue
          [Pipeline] }
          [Pipeline] // stage
          {code}
           

           

           

           
          Konstantin Shipkov made changes -
          Description Original: When setting a default value for a password parameter from shared library code, we get the warning "_Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue_" in the build log .

          As an example, the Jenkinsfile:

           
          {code:java}
          #!/usr/bin/env groovy @Library('<git-branch-name>')_
          passwordUse()
          {code}
          shared library, vars/passwordUse.groovy:

           

           
          {code:java}
          def call() {
              stage('Show parameters') {
                  echo "test_password : " + params.test_password
              }
              stage('Add password parameter') {
                  properties([
                          parameters([
                                  password(name: 'test_password', defaultValue: 'default_password', description: 'test password')
                          ])
                  ])
              }
          }
          {code}
          The warning in the build log:

           

           
          {code:java}
          [Pipeline] stage
          [Pipeline] { (Add password parameter)
          [Pipeline] properties (hide)
          WARNING: Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue
          [Pipeline] }
          [Pipeline] // stage
          {code}
           

           

           

           
          New: When setting a default value for a password parameter from shared library code, we get the warning "_Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue_" in the build log .

          As an example, the Jenkinsfile: 
          {code:java}
          #!/usr/bin/env groovy @Library('<git-branch-name>')_
          passwordUse()
          {code}
          shared library, vars/passwordUse.groovy: 
          {code:java}
          def call() {
              stage('Show parameters') {
                  echo "test_password : " + params.test_password
              }
              stage('Add password parameter') {
                  properties([
                          parameters([
                                  password(name: 'test_password', defaultValue: 'default_password', description: 'test password')
                          ])
                  ])
              }
          }
          {code}
          The warning in the build log: 
          {code:java}
          [Pipeline] stage
          [Pipeline] { (Add password parameter)
          [Pipeline] properties (hide)
          WARNING: Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue
          [Pipeline] }
          [Pipeline] // stage
          {code}

            Unassigned Unassigned
            kship Konstantin Shipkov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: