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

Configuration of password parameters broken in Declarative Pipelines in Jenkins 2.236+

    • pipeline-model-definition 1.7.2

      Hello, 

      Getting error below

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 12: Invalid parameter "defaultValue", did you mean "defaultValueAsSecret"? @ line 12, column 36.
      password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')
      ^

      1 error

      at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
      at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
      at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      Finished: FAILURE

      pipeline {
          agent any
          parameters {
              string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')
      
              password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')
          }
          stages {
              stage('Example') {
                  steps {
                      echo "Hello ${params.PERSON}"
      
                      echo "Password: ${params.PASSWORD}"
                  }
              }
          }
      }
      

       

       

          [JENKINS-63499] Configuration of password parameters broken in Declarative Pipelines in Jenkins 2.236+

          Atish Agarwal created issue -
          Atish Agarwal made changes -
          Description Original: Hello, 

          Getting error below

          org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
          *WorkflowScript: 12: Invalid parameter "defaultValue", did you mean "defaultValueAsSecret"? @ line 12, column 36.*
           *password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')*
           ^

          1 error

          at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
           at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
           at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
           at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
           at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
           at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
           at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
           at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
           at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
           at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
           at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
           at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
           at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
           at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:428)
          Finished: FAILURE
          {code:java}
          // pipeline {
              agent any
              parameters {
                  string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')

                  password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')
              }
              stages {
                  stage('Example') {
                      steps {
                          echo "Hello ${params.PERSON}"

                          echo "Password: ${params.PASSWORD}"
                      }
                  }
              }
          }
          {code}
           

           
          New: Hello, 

          Getting error below

          org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
           *WorkflowScript: 12: Invalid parameter "defaultValue", did you mean "defaultValueAsSecret"? @ line 12, column 36.*
           *password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')*
           ^

          1 error

          at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
           at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
           at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
           at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
           at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
           at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
           at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
           at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
           at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
           at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
           at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
           at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
           at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
           at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:428)
           Finished: FAILURE
          {code:java}
          pipeline {
              agent any
              parameters {
                  string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')

                  password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')
              }
              stages {
                  stage('Example') {
                      steps {
                          echo "Hello ${params.PERSON}"

                          echo "Password: ${params.PASSWORD}"
                      }
                  }
              }
          }
          {code}
           

           

          Devin Nusbaum added a comment -

          I think this is caused by JENKINS-61808 and is somewhat similar to JENKINS-62305. Unless the original changes made for JENKINS-61808 in core are altered, I think the only way to restore compatibility is to add a special case to this code in pipeline-model-definition and have it convert "defaultValue: blah" into "defaultValueAsSecret: Secret.fromString(blah)" behind the scenes.

          That said, the relevant documentation should also be updated to recommend using credentials parameters instead of password parameters.

          Devin Nusbaum added a comment - I think this is caused by JENKINS-61808 and is somewhat similar to JENKINS-62305 . Unless the original changes made for JENKINS-61808 in core are altered, I think the only way to restore compatibility is to add a special case to this code in pipeline-model-definition and have it convert "defaultValue: blah" into "defaultValueAsSecret: Secret.fromString(blah)" behind the scenes. That said, the relevant documentation should also be updated to recommend using credentials parameters instead of password parameters.
          Devin Nusbaum made changes -
          Link New: This issue is caused by JENKINS-61808 [ JENKINS-61808 ]
          Devin Nusbaum made changes -
          Summary Original: Password Parameter is not working with Jenkins v2.253 New: Password parameters cannot be configured in Declarative in Jenkins 2.236+
          Devin Nusbaum made changes -
          Summary Original: Password parameters cannot be configured in Declarative in Jenkins 2.236+ New: Configuration of password parameters broken in Declarative Pipelines in Jenkins 2.236+
          Devin Nusbaum made changes -
          Component/s New: pipeline-model-definition-plugin [ 21706 ]
          Component/s Original: pipeline [ 21692 ]
          Devin Nusbaum made changes -
          Issue Type Original: Task [ 3 ] New: Bug [ 1 ]
          Devin Nusbaum made changes -
          Link New: This issue relates to JENKINS-63516 [ JENKINS-63516 ]
          Devin Nusbaum made changes -
          Assignee New: Devin Nusbaum [ dnusbaum ]

            dnusbaum Devin Nusbaum
            atish9308 Atish Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: