Hello,
      I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.

      pipelineJob(path) {

       displayName(job_name)

       description(description)

      parameters {

          choiceParam(it.name, it.choices, it.description)

          stringParam(it.name, default_value, it.description)

          nonStoredPasswordParam(it.name, it.description) 

      }

      ...}

      Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
      Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

      Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:

       pipeline

      {     options  

      {  ...  }

          parameters

      {       password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')    }

               environment { ... }

               agent { ... }

               stages { ... }

      }

      path = "folder1/folder2/pipelineA"

      name = "MY_PASSWD"

      default_password = "default"

      description = "My lovely password"

      newParameters = []

      newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

      newParameters.add(newParam)
      Jenkins instance = Jenkins.getInstance()

      def job = Jenkins.instance.getItemByFullName(path)
      for (prop in job.getAllProperties()) {

          if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

              for (param in prop.parameterDefinitions) {

                   println("Taken Parameter: ${param.name}")

                   newParameters.add(param)

              }

          }

      }
      // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

      job.addProperty(new ParametersDefinitionProperty(newParameters))

      instance.save()

       

      Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

      Regards

          [JENKINS-67973] Job DSL plugin: passwordParam not available

          Gautier BEGIN created issue -
          Gautier BEGIN made changes -
          Description Original: {{ Hello,}}
          {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}
          {{pipelineJob(path}}{{) {}}

          {{ displayName(job_name)}}

          {{ description(description)}}{{ }}

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

          {{    nonStoredPasswordParam(it.name, it.description) }}

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
          Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]


          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

          {quote} pipeline {

              options \{ ... }

              parameters {

                  password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password') }

                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote} * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
          Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
          for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
          // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?


          Regards
          New: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

          {\{ displayName(job_name)}}

          {\{ description(description)}}\{{ }}

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline
          Unknown macro: \{     options { ... }
              parameters
          Unknown macro: \{         password(name}
                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote}
          * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          Gautier BEGIN made changes -
          Description Original: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

          {\{ displayName(job_name)}}

          {\{ description(description)}}\{{ }}

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline
          Unknown macro: \{     options { ... }
              parameters
          Unknown macro: \{         password(name}
                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote}
          * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          New: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline {
              options{ ... }

              parameters {
                password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')

          }
                    environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote} * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          Gautier BEGIN made changes -
          Description Original: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline {
              options{ ... }

              parameters {
                password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')

          }
                    environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote} * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          New: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline {
               options { ... }

              parameters {
                  password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')
          }
                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote}
          * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          Gautier BEGIN made changes -
          Description Original: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline {
               options { ... }

              parameters {
                  password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')
          }
                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote}
          * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          New: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline {
               options {  ...  }

              parameters  {  
                  password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')   }
                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote} * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          Gautier BEGIN made changes -
          Description Original: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           
          {quote} pipeline {
               options {  ...  }

              parameters  {  
                  password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')   }
                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
          {quote} * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          New: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           pipeline {
               options  \{  ...  }

              parameters {

                password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')

             }

                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }

          * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           

           

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          Gautier BEGIN made changes -
          Description Original: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself:

           pipeline {
               options  \{  ...  }

              parameters {

                password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')

             }

                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }

          * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] :

           

           

           
          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          New: {{ Hello,}}
           {{I'm using a DSL pipeline to create all my Jenkins jobs, from the job DSL plugin. Till now, when a password as parameter was required, I was using nonStoredPasswordParam from the "Mask Passwords" plugin.}}
          {quote}{{pipelineJob(path}}{{) {}}

           displayName(job_name)

           description(description)

          {{parameters {}}

          {{    choiceParam(it.name, it.choices, it.description)}}

          {{    stringParam(it.name, default_value, it.description)}}

              nonStoredPasswordParam(it.name, it.description) 

          {{}}}

          {{...}}{{}}}
          {quote}
          Currently, one of my customer requires to be able to reuse its previous password (Rebuild or Replay from stage), even if the pipeline is recreated between the first build and the rebuild (bug correction). The only solution I found was to use the legacy passwordParam feature.
           Unfortunately, I found no way to used it (passwordParam) in a DSL script and get this error message: ERROR: (unknown source) No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.passwordParam() is applicable for argument types: (java.lang.String, null, java.lang.String) values: [APPOWNERPWD, null, Password demo]

          Despite of this of error, I was able to create this kind of parameter using the direct declaration in the created pipeline or using a groovy:
           * Create the password directly in the created pipeline itself: [https://itnext.io/jenkins-tutorial-part-3-parameterized-pipeline-3898643ac6ad

           pipeline

          {     options  \\{  ...  }

              parameters

          {       password(name: 'MY_PASSWD', defaultValue: 'default', description: 'My lovely password')    }

                   environment \{ ... }

                   agent \{ ... }

                   stages \{ ... }

          }
           * Modification of the pipeline once created using a Groovy script, like in [https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96] : 

          {quote}path = "folder1/folder2/pipelineA"

          name = "MY_PASSWD"

          default_password = "default"

          description = "My lovely password"

          newParameters = []

          newParam = new hudson.model.PasswordParameterDefinition(name, default_password, description)

          newParameters.add(newParam)
           Jenkins instance = Jenkins.getInstance()

          def job = Jenkins.instance.getItemByFullName(path)
           for (prop in job.getAllProperties()) {

              if ( prop instanceof hudson.model.ParametersDefinitionProperty ) {

                  for (param in prop.parameterDefinitions) {

                       println("Taken Parameter: ${param.name}")

                       newParameters.add(param)

                  }

              }

          }
           // Resetting the job pipeline definitionjob.removeProperty(ParametersDefinitionProperty.class)

          job.addProperty(new ParametersDefinitionProperty(newParameters))

          instance.save()
          {quote}
           

          Could you improve the DSL plugin to allow the usage of the hudson.model.PasswordParameterDefinition kind of parameter?

          Regards
          Environment New: Jenkins: 2.289.3
          Job DSL Plugin: 1.77
          Mass Password Plugin: 3.0
          Gautier BEGIN made changes -
          Environment Original: Jenkins: 2.289.3
          Job DSL Plugin: 1.77
          Mass Password Plugin: 3.0
          New: Jenkins: 2.289.3
          Job DSL Plugin: 1.77
          Mask Password Plugin: 3.0

            jamietanna Jamie Tanna
            gbegin Gautier BEGIN
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: