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

(PDK-842) Wire puppet-version and pe-version options into subcommands #480

Merged
merged 6 commits into from
Apr 23, 2018

Conversation

scotje
Copy link
Contributor

@scotje scotje commented Apr 18, 2018

Unless otherwise stated, packaged install stuff requires packages built from the HEAD of master on pdk-vanagon.

@scotje scotje added the blocked label Apr 18, 2018
@coveralls
Copy link

coveralls commented Apr 18, 2018

Coverage Status

Coverage decreased (-0.02%) to 92.235% when pulling 1f56df6 on scotje:842_its_aliveeeee into 101ef66 on puppetlabs:master.

@rodjek
Copy link
Contributor

rodjek commented Apr 18, 2018

@scotje I've made some changes to get the existing unit and acceptance tests to pass with these changes. The only major behavioural change that you might want to review is in 284c693

# If there were missing dependencies when we checked above, let `bundle install`
# go out and get them. For packaged installs, this should only be true if the user
# has added custom gems that we don't vendor.
unless bundle.installed?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that's odd. If all_deps_available was true then bundle lock --update shouldn't reach out to rubygems for updates since we are passing the --local flag. This shouldn't hurt anything though but it is curious.

@rodjek
Copy link
Contributor

rodjek commented Apr 20, 2018

So, this is what it'd look like with --puppet-version/--pe-version as global flags for use in pdk bundle. This command being special and skipping argument parsing would require the option to come between pdk and bundle (as everything after bundle is considered an argument).

semirhage :0: pdk/foo (git:842_its_aliveeeee → scotje U:4 ?:1!)$ ../bin/pdk --puppet-version 4.7.0 bundle exec puppet --version
pdk (INFO): Using Ruby 2.1.10
pdk (INFO): Using Puppet 4.7.0
[✔] Installing missing Gemfile dependencies.
4.7.0

semirhage :0: pdk/foo (git:842_its_aliveeeee → scotje U:4 ?:1!)$ ../bin/pdk --puppet-version 5.5.0 bundle exec puppet --version
pdk (INFO): Using Ruby 2.1.10
pdk (INFO): Using Puppet 5.5.0
5.5.0

I'm honestly not sure if it's worth it to have the specific option ordering for this command vs using an env var to set the desired puppet version for pdk bundle... I guess consistency would be the main point in its favour. I'll leave it for you @scotje and @bmjen to discuss and squash or drop the commit as appropriate :)

@scotje
Copy link
Contributor Author

scotje commented Apr 20, 2018

My vote would be to recognize values from PDK_PUPPET_VERSION and PDK_PE_VERSION environment variables and not make the --puppet-version and --pe-version options global.

My reasoning:

  • Long term I think we should be aiming to remove the bundle subcommand. It's an escape hatch for use cases we haven't yet considered or addressed but part of the whole reason for PDK existing is to make it unnecessary for people to even be aware of Bundler.
  • Making option strings more positional is bad for UX.
  • Having those options show up in the help output for subcommands where they have no impact is also bad for UX.

@bmjen
Copy link
Contributor

bmjen commented Apr 20, 2018

@rodjek IMO, we shouldn't bother with adding those flags to pdk bundle or anywhere other than validate and test unit. With pdk bundle being an experimental command, it doesn't seem necessary. It may also cause complications when users traditionally are used to passing in session vars to bundler like PUPPET_GEM_VERSION=file:///puppet pdk bundle update to do some more advanced use cases.

c.add_spinner(_('Resolving Gemfile dependencies.'))
c.update_environment(gemfile_env(gem_overrides)) unless gem_overrides.empty?
c.add_spinner(_('Resolving default Gemfile dependencies.'))
# c.update_environment(gemfile_env(gem_overrides)) unless gem_overrides.empty?
Copy link
Contributor

Choose a reason for hiding this comment

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

This commented needs to be removed or a reason for leaving it should be documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah I've been meaning to remove this line.

@bmjen
Copy link
Contributor

bmjen commented Apr 20, 2018

Aside from my commit.. this LGTM with the latest changes.

@rodjek rodjek force-pushed the 842_its_aliveeeee branch 3 times, most recently from 24d8471 to 0ee7ebc Compare April 23, 2018 05:19
@bmjen bmjen merged commit 468b6eb into puppetlabs:master Apr 23, 2018
@scotje scotje deleted the 842_its_aliveeeee branch April 23, 2018 19:10
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.

5 participants