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

Use of password parameters with the input step broken in Jenkins 2.236+


    • pipeline-input-step 2.12

      JENKINS-61808 changed the way that password parameters are constructed via data binding. This breaks existing uses of the input step that have a password parameter in Jenkins 2.236 and newer, and is analogous to JENKINS-63499. For example, this is is an example of something that used to work but no longer does:

      input(message: 'Approve?', parameters: [password(name: 'foo', defaultValue: 'bar', description: 'baz')])

      In Jenkins 2.236, it will throw the following exception:

      java.lang.IllegalArgumentException: WARNING: Unknown parameter(s) found for class type 'hudson.model.PasswordParameterDefinition': defaultValue
         at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:322)
         at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:474)
         at org.jenkinsci.plugins.structs.describable.DescribableModel.coerceList(DescribableModel.java:585)
         at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:458)
         at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:429)
         at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:331)
         at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:269)
         at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:179)
         at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)

      If Secret.fromString were available for use in the sandbox, users could manually modify their Pipelines like this as a workaround:

      input(message: 'Approve?', parameters: [password(name: 'foo', defaultValueAsSecret: Secret.fromString('bar'), description: 'baz')])

      Unless we change something about how JENKINS-61808 was implemented in core, I think the only fix would to have InputStep implement customInstantiate and customUninstantiate similarly to what was done for the build step in JENKINS-62305.

            dnusbaum Devin Nusbaum
            dnusbaum Devin Nusbaum
            0 Vote for this issue
            2 Start watching this issue