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

specifying the environment variable PUPPET_GEM_VERSION does not work #635

Closed
ghoneycutt opened this issue Mar 4, 2019 · 7 comments
Closed
Labels
JIRA JIRA Ticket Created

Comments

@ghoneycutt
Copy link

ghoneycutt commented Mar 4, 2019

Describe the bug
The Gemfile allows for specifying the puppet version with the environment variable PUPPET_GEM_VERSION. When this is done, errors happens where I would expect no errors and for PDK to use the version specified.

To Reproduce

export PUPPET_GEM_VERSION=6.3.0
pdk validate

Expected behavior
For PDK to use Puppet 6.3.0 and for the tests to succeed.

Additional context

  • Your PDK installation method: native packages

  • Your PDK version: 1.9.0

  • Your operating system / platform: MacOS Mojave

@rodjek
Copy link
Contributor

rodjek commented Mar 4, 2019

PUPPET_GEM_VERSION is not part of the PDK "public API". It remains in the puppetlabs/pdk-templates Gemfile template for compatibility with existing CI setups that call the rake tasks from puppetlabs_spec_helper. The correct way to specify the Puppet version with PDK commands is the --puppet-version or --pe-version flags - https://puppet.com/docs/pdk/1.x/pdk_reference.html#pdk-validate-command.

@rodjek rodjek closed this as completed Mar 4, 2019
@ghoneycutt
Copy link
Author

ghoneycutt commented Mar 4, 2019

Thanks for explaining how to achieve this! Please re-open though as specifying this environment variable should not cause pdk to not work. Would expect that pdk would ignore it and continue on or document that specifying this will break things.

@rodjek rodjek reopened this Mar 6, 2019
@scotje
Copy link
Contributor

scotje commented Mar 19, 2019

@ghoneycutt can you clarify what errors you are receiving in this situation? PDK should be ignoring the exported value of PUPPET_GEM_VERSION as it carefully manages the execution environment of it's subprocesses.

(Edit: I tried and was unable to replicate this issue in my local environment.)

@rodjek rodjek added the needs information Waiting for additional information from reporter label Mar 20, 2019
@ghoneycutt
Copy link
Author

ghoneycutt commented Mar 22, 2019

I could not reproduce using the steps above with PDK 1.9.1. Though I was able to get this error when running pdk test unit

rpcbind$ export PUPPET_GEM_VERSION=6.3.0
rpcbind$ pdk test unit
pdk (INFO): Using Ruby 2.5.3
pdk (INFO): Using Puppet 6.2.0
[✔] Installing missing Gemfile dependencies.
pdk (FATAL): Failed to generate binstubs for 'rake rspec-core':
You have requested:
  puppet = 6.3.0

The bundle currently has puppet locked at 6.2.0.
Try running `bundle update puppet`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`


pdk (FATAL): Unable to install requested binstubs.

@ghoneycutt
Copy link
Author

This makes adoption hard as I normally export that variable with the current work flow that uses rvm and bundler. When migrating to PDK I have to remember to unset it. A better user experience would be PDK telling me that it is set and that it shouldn't be and that it's going to ignore it and tell me to use --puppet-version or --pe-version to specify the version.

@scotje
Copy link
Contributor

scotje commented Apr 1, 2019

I have created https://tickets.puppetlabs.com/browse/PDK-1337 to track this in JIRA.

@scotje scotje added JIRA JIRA Ticket Created and removed needs information Waiting for additional information from reporter labels Apr 1, 2019
@rodjek
Copy link
Contributor

rodjek commented Jun 6, 2019

Fixed in #671

@rodjek rodjek closed this as completed Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JIRA JIRA Ticket Created
Projects
None yet
Development

No branches or pull requests

3 participants