Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-1113) (GH-917) Fix forge-token handling #1121

Merged
merged 2 commits into from
Jul 8, 2021
Merged

(GH-1113) (GH-917) Fix forge-token handling #1121

merged 2 commits into from
Jul 8, 2021

Conversation

sanfrancrisko
Copy link
Contributor

@sanfrancrisko sanfrancrisko commented Jul 6, 2021

This PR contains two fixes:

(GH-1113) Fix incorrect opt type for forge-token

Prior to this fix, the forge-token option defined in the PDK::CLI's
release subcommand did not have the argument: attribute set.
This meant that the underlying Cri lib treated it as a boolean option
and the forge token value was set to true and passed to the
PDK::Module::Release object.

This fix sets the argument: attribute with the value :required,
which emulates the way it is set in the publish subcommand.

Closes: #1113


(GH-917) Fix incorrect 'Missing forge-token' error throwing

Prior to this fix, the forge-token option defined in the PDK::CLI's
release subcommand did not have the argument: attribute set.
This meant that the underlying Cri lib treated it as a boolean option
and the forge token value was set to true and passed to the
PDK::Module::Release object.

This fix sets the argument: attribute with the value :optional,
which allows it to be optional but treated as an arg that needs the
value extracted after =

Resolves: #917

@sanfrancrisko sanfrancrisko changed the title Pdk 1113/main/forge token arg fix (PDK-1113) Fix incorrect opt type for forge-token in release cmd Jul 6, 2021
@sanfrancrisko sanfrancrisko self-assigned this Jul 6, 2021
@sanfrancrisko sanfrancrisko requested review from a team and michaeltlombardi July 6, 2021 17:44
@sanfrancrisko sanfrancrisko added this to the 2.2.0 milestone Jul 6, 2021
@sanfrancrisko sanfrancrisko marked this pull request as ready for review July 6, 2021 17:45
@sanfrancrisko sanfrancrisko changed the title (PDK-1113) Fix incorrect opt type for forge-token in release cmd (PDK-1113) Fix incorrect opt type for forge-token in release cmd Jul 6, 2021
@codecov
Copy link

codecov bot commented Jul 6, 2021

Codecov Report

Merging #1121 (18754e5) into main (11416c3) will decrease coverage by 0.01%.
The diff coverage is 50.00%.

❗ Current head 18754e5 differs from pull request most recent head 6c2c4e9. Consider uploading reports for the commit 6c2c4e9 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1121      +/-   ##
==========================================
- Coverage   91.25%   91.24%   -0.02%     
==========================================
  Files         137      137              
  Lines        5570     5571       +1     
==========================================
  Hits         5083     5083              
- Misses        487      488       +1     
Impacted Files Coverage Δ
lib/pdk/cli/release.rb 49.43% <50.00%> (-0.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dca0eb7...6c2c4e9. Read the comment docs.

@sanfrancrisko
Copy link
Contributor Author

sanfrancrisko commented Jul 7, 2021

sanfrancrisko added 2 commits July 7, 2021 18:53
Prior to this fix, the `forge-token` option defined in the PDK::CLI's
`release` subcommand did not have the `argument:` attribute set.
This meant that the underlying Cri lib treated it as a boolean option
and the forge token value was set to `true` and passed to the
`PDK::Module::Release` object.

This fix sets the `argument:` attribute with the value `:optional`,
which allows it to be optional but treated as an arg that needs the
value extracted after `=`
Prior to this commit, when running `pdk release` and stepping
through the interview questions, even if you selected `N` to the
publish forge question, a warning would still display stating:

```sh
pdk (ERROR): Missing forge-token option
```

This commit sets the `:skip_publish` option to true in `opts` that
gets passed to the `PDK::Module::Release` object on init. This will
ensure that the `skip_publish?` call returns `true` and the
Forge token check is not performed.

This was incorrectly asserted as resolved in `2.1.1` of the PDK.
@sanfrancrisko sanfrancrisko changed the title (PDK-1113) Fix incorrect opt type for forge-token in release cmd (GH-1113, GH-917) Fix incorrect opt type for forge-token; Fix incorrect 'Missing forge-token' error throwing Jul 7, 2021
@sanfrancrisko sanfrancrisko changed the title (GH-1113, GH-917) Fix incorrect opt type for forge-token; Fix incorrect 'Missing forge-token' error throwing (GH-1113) Fix incorrect opt type for forge-token; (GH-917)Fix incorrect 'Missing forge-token' error throwing Jul 7, 2021
@sanfrancrisko sanfrancrisko changed the title (GH-1113) Fix incorrect opt type for forge-token; (GH-917)Fix incorrect 'Missing forge-token' error throwing (GH-1113) Fix incorrect opt type for forge-token; (GH-917) Fix incorrect 'Missing forge-token' error throwing Jul 7, 2021
@jpogran jpogran changed the title (GH-1113) Fix incorrect opt type for forge-token; (GH-917) Fix incorrect 'Missing forge-token' error throwing (GH-1113) (GH-917) Fix forge-token handling Jul 7, 2021
Copy link

@da-ar da-ar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

veriried locally, appears to work as expected

@da-ar da-ar merged commit 2c76a53 into puppetlabs:main Jul 8, 2021
@sanfrancrisko sanfrancrisko deleted the PDK-1113/main/forge_token_arg_fix branch July 8, 2021 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pdk release: --forge-token is true instead of string pdk release fails to build without token
3 participants