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

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

    XMLWordPrintable

Details

    • pipeline-model-definition 1.7.2

    Description

      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}"
                  }
              }
          }
      }
      

       

       

      Attachments

        Issue Links

          Activity

            atish9308 Atish Agarwal created issue -
            atish9308 Atish Agarwal made changes -
            Field Original Value New Value
            Description 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}
             

             
            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}
             

             
            dnusbaum 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.

            dnusbaum 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.
            dnusbaum Devin Nusbaum made changes -
            Link This issue is caused by JENKINS-61808 [ JENKINS-61808 ]
            dnusbaum Devin Nusbaum made changes -
            Summary Password Parameter is not working with Jenkins v2.253 Password parameters cannot be configured in Declarative in Jenkins 2.236+
            dnusbaum Devin Nusbaum made changes -
            Summary Password parameters cannot be configured in Declarative in Jenkins 2.236+ Configuration of password parameters broken in Declarative Pipelines in Jenkins 2.236+
            dnusbaum Devin Nusbaum made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s pipeline [ 21692 ]
            dnusbaum Devin Nusbaum made changes -
            Issue Type Task [ 3 ] Bug [ 1 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-63516 [ JENKINS-63516 ]
            dnusbaum Devin Nusbaum made changes -
            Assignee Devin Nusbaum [ dnusbaum ]
            dnusbaum Devin Nusbaum made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            dnusbaum Devin Nusbaum made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            dnusbaum Devin Nusbaum added a comment -

            Currently trying to fix the main regression in https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/404.

            dnusbaum Devin Nusbaum added a comment - Currently trying to fix the main regression in  https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/404 .
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/pipeline-model-definition-plugin#404 (Web Link)" [ 25714 ]
            dnusbaum Devin Nusbaum added a comment -

            A fix for this issue was just released in Pipeline: Declarative plugin version 1.7.2.

            dnusbaum Devin Nusbaum added a comment - A fix for this issue was just released in Pipeline: Declarative plugin version 1.7.2.
            dnusbaum Devin Nusbaum made changes -
            Released As pipeline-model-definition 1.7.2
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved: