RDTK / generator

A tool for creating Jenkins jobs and other things from recipes describing software projects
GNU General Public License v3.0
21 stars 3 forks source link

Parameters Aspect: support password #53

Closed LeroyR closed 3 years ago

LeroyR commented 3 years ago

Is your feature request related to a problem? Please describe. Parameters aspect does not support parameters of type 'password'

Describe the solution you'd like support parameter of type password for jenkins

PROJECT-DEPLOYMENT-ERROR:
    Error during deployment of project version test:deploy-volume:with_params
    to #<TARGET {100B2AE6F3}>. Caused by:
    > Error during deployment of
    > #<JOB test:deploy-volume:with_params:main {100AB70C33}> to
    > #<TARGET {100B2AE6F3}>. Caused by:
    > > The value
    > > (((:NAME . "ssh_user") (:KIND . "password"))
    > >  ((:NAME . "ssh_password") (:KIND . "password")))
    > > which has been supplied for the :ASPECT.PARAMETERS.PARAMETERS parameter
    > > of
    > > #<ASPECT-PARAMETERS test:deploy-volume:with_params:main:parameters {100ACD1FF3}>
    > > is not of type
    > > (OR
    > >  (BUILD-GENERATOR.MODEL.VARIABLES:LIST-OF
    > >   BUILD-GENERATOR.MODEL.ASPECTS::PARAMETER-ENTRY)
    > >  (BUILD-GENERATOR.MODEL.VARIABLES:LIST-OF
    > >   BUILD-GENERATOR.MODEL.ASPECTS::PARAMETER-ENTRY/LEGACY)).
    > > Caused by:
    > > > The value
    > > > (((:NAME . "ssh_user") (:KIND . "password"))
    > > >  ((:NAME . "ssh_password") (:KIND . "password")))
    > > > cannot be interpreted as a value of type
    > > > (OR
    > > >  (BUILD-GENERATOR.MODEL.VARIABLES:LIST-OF
    > > >   BUILD-GENERATOR.MODEL.ASPECTS::PARAMETER-ENTRY)
    > > >  (BUILD-GENERATOR.MODEL.VARIABLES:LIST-OF
    > > >   BUILD-GENERATOR.MODEL.ASPECTS::PARAMETER-ENTRY/LEGACY)).
scymtym commented 3 years ago

I don't think it is possible (with reasonable effort and decent expected robustness of the result) to implement this since Jenkins encrypts the supplied password in some undocumented (at the user level) way. For example, adding a password parameter with the value test (or similar), results in this configuration:

<hudson.model.ParametersDefinitionProperty>
  <parameterDefinitions>
    <hudson.model.PasswordParameterDefinition>
      <name>Foo</name>
      <defaultValue>{AQAAABAAAAAQ+PDLeSphWaJH3mXlJSiAOwJz2idoo/6SZ/MuKifthZI=}</defaultValue>
    </hudson.model.PasswordParameterDefinition>
  </parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
scymtym commented 3 years ago

It would probably be possible to support this parameter kind without default values, thought.

LeroyR commented 3 years ago

Default values dont make much sense anyway 🙃