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

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

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      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

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

            Show
            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.
            Hide
            dnusbaum Devin Nusbaum added a comment -

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

            Show
            dnusbaum Devin Nusbaum added a comment - Currently trying to fix the main regression in  https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/404 .
            Hide
            dnusbaum Devin Nusbaum added a comment -

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

            Show
            dnusbaum Devin Nusbaum added a comment - A fix for this issue was just released in Pipeline: Declarative plugin version 1.7.2.

              People

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

                Dates

                Created:
                Updated:
                Resolved: