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

Add forge token env #913

Merged
merged 2 commits into from
Sep 14, 2020
Merged

Add forge token env #913

merged 2 commits into from
Sep 14, 2020

Conversation

scotje
Copy link
Contributor

@scotje scotje commented Aug 27, 2020

@logicminds it wouldn't let me push to your fork, but I took your commit and changed a couple things:

  • renamed the env var to be more consistent with existing PDK env vars
  • removed the default value from the CLI help and instead just fall-back to env if CLI value is empty
  • use the PDK::Util env helpers
  • added unit tests

Supersedes #912

logicminds and others added 2 commits August 26, 2020 06:04
  * Previously when using the release command the user
    had to enter the forge token every time they released.
    This is annoying and is not compatible with CI systems.

    This commit allows the user or CI to set PUPPET_FORGE_TOKEN
    environment variable so they are not burdened with prompts.

    This also makes the default cli option the value of the environment variable.

    Note: when help is displayed the token is also displayed.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 92.654% when pulling a42cafa on scotje:add_forge_token_env into 226a101 on puppetlabs:master.

@logicminds
Copy link
Contributor

The cli argument is required and I suspect the cli will fail even if the env variable is set because no default is supplied. Was this covered in your test?

@scotje
Copy link
Contributor Author

scotje commented Aug 27, 2020

@logicminds argument: required on a CLI option just means that, if you specify that option, you must include a value. So, you can't just say pdk release publish --forge-token, you would have to say pdk release publish --forge-token=foo. But it does not mean that the option itself is required.

$ pdk release publish
pdk (ERROR): You must supply a Forge API token either via `--forge-token` option or PDK_FORGE_TOKEN environment variable.
$ pdk release publish --forge-token
publish: option requires an argument -- forge-token
$ PDK_FORGE_TOKEN=abc123 pdk release publish
pdk (INFO): Releasing jesse-testmod - from version 0.1.0
pdk (INFO): Uploading tarball to puppet forge...

@scotje scotje merged commit a4a0788 into puppetlabs:master Sep 14, 2020
@scotje scotje deleted the add_forge_token_env branch September 14, 2020 23:56
@scotje scotje added this to the June 2020 milestone Sep 14, 2020
@scotje scotje added the feature label Feb 24, 2021
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.

3 participants