puppetlabs / pdk

The shortest path to better modules: Puppet Development Kit; Download:
https://puppet.com/download-puppet-development-kit
Apache License 2.0
225 stars 105 forks source link

pdk release: `--forge-token` is `true` instead of string #1113

Closed michaeltlombardi closed 3 years ago

michaeltlombardi commented 3 years ago

Describe the bug While trying to release updated versions of the dsc-* modules, discovered a bug where the forge token is somehow turning into true instead of the passed string.

pdk (INFO): Releasing dsc-octopusdsc - from version 4.0.934-0-2
pdk (INFO): Uploading tarball to puppet forge...
C:/Program Files/Puppet Labs/DevelopmentKit/private/ruby/2.4.10/lib/ruby/gems/2.4.0/gems/pdk-2.1.1/lib/pdk/module/release.rb:160:in `+': no implicit conversion of true into String (TypeError)

https://github.com/puppetlabs/pdk/blob/dca0eb783de78d11007b07d7734ebe95f4597447/lib/pdk/module/release.rb#L160

To Reproduce On Windows 10 with PDK 2.1.1

pdk release --forge-token=my_token_here --skip-changelog --skip-validation --skip-documentation --skip-dependency --force

Expected behavior I expect the forge token passed at the commandline (in the example repro code, my_token_here to be used for bearer auth in a Forge API call.

Additional context

sanfrancrisko commented 3 years ago

Can reproduce this locally. I believe the --forge-token arg value is being mangled somewhere in the Cri::Command.run method (or further down).

At this point it's the string value of what is passed to --forge-token: https://github.com/puppetlabs/pdk/blob/dca0eb783de78d11007b07d7734ebe95f4597447/lib/pdk/cli.rb#L69

But it then appears to be mangled in to a boolean somewhere:

   #<Cri::OptionDefinition:0x00007f84ac0f9fc8
     @argument=:forbidden,
     @block=nil,
     @default=false,
     @desc="Set Forge API token.",
     @hidden=false,
     @long="forge-token",
     @multiple=false,
     @short=nil,
     @transform=nil>,

Wasn't able to quickly determine where this is. Also tried a few things to see if we were setting this argument incorrectly, but it didn't yield any results.

Will need to dig in further.