Skip to content

Conversation

@n-rodriguez
Copy link
Contributor

@n-rodriguez n-rodriguez commented May 13, 2019

It helps to avoid issues like this one :

nicolas@laptop:~/PROJECTS/GITHUB/template-formula$ kitchen list
WARN: Unresolved or ambigious specs during Gem::Specification.reset:
      mime-types-data (~> 3.2015)
      Available/installed versions of this gem:
      - 3.2019.0331
      - 3.2018.0812
      os (>= 0.9, < 2.0)
      Available/installed versions of this gem:
      - 1.0.1
      - 1.0.0
      excon (>= 0.47.0)
      Available/installed versions of this gem:
      - 0.64.0
      - 0.62.0
      azure_mgmt_resources (~> 0.15)
      Available/installed versions of this gem:
      - 0.17.4
      - 0.17.3
      concurrent-ruby (~> 1.0)
      Available/installed versions of this gem:
      - 1.1.5
      - 1.1.4
      unf_ext (>= 0)
      Available/installed versions of this gem:
      - 0.0.7.6
      - 0.0.7.5
      azure_mgmt_key_vault (~> 0.17)
      Available/installed versions of this gem:
      - 0.17.4
      - 0.17.3
      rspec-its (~> 1.2)
      Available/installed versions of this gem:
      - 1.3.0
      - 1.2.0
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
Instance                             Driver  Provisioner  Verifier  Transport  Last Action    Last Error
default-debian-9-2019-2-py3          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-ubuntu-1804-2019-2-py3       Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-centos-7-2019-2-py3          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-fedora-29-2019-2-py3         Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-opensuse-leap-15-2019-2-py3  Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-debian-9-2018-3-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-ubuntu-1604-2018-3-py2       Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-centos-7-2018-3-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-fedora-29-2018-3-py2         Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-opensuse-leap-42-2018-3-py2  Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-debian-8-2017-7-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-ubuntu-1604-2017-7-py2       Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-centos-6-2017-7-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-fedora-28-2017-7-py2         Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-opensuse-leap-42-2017-7-py2  Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>

nicolas@laptop:~/PROJECTS/GITHUB/template-formula$ bin/kitchen list
Instance                             Driver  Provisioner  Verifier  Transport  Last Action    Last Error
default-debian-9-2019-2-py3          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-ubuntu-1804-2019-2-py3       Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-centos-7-2019-2-py3          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-fedora-29-2019-2-py3         Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-opensuse-leap-15-2019-2-py3  Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-debian-9-2018-3-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-ubuntu-1604-2018-3-py2       Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-centos-7-2018-3-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-fedora-29-2018-3-py2         Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-opensuse-leap-42-2018-3-py2  Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-debian-8-2017-7-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-ubuntu-1604-2017-7-py2       Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-centos-6-2017-7-py2          Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-fedora-28-2017-7-py2         Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>
default-opensuse-leap-42-2017-7-py2  Docker  SaltSolo     Inspec    Ssh        <Not Created>  <None>

@myii myii requested a review from aboe76 May 13, 2019 22:43
@javierbertoli
Copy link
Member

@n-rodriguez the issue that you're trying to solve with this PR seems to be an issue (or misconfiguration) in your local development environment (perhaps can be solved with just a gem clean?).

I don't think that these changes belong in the formula space, as correctly setting up and maintaining the development environment is prior work people should do beforehand and, most probably, not 2 environments will be setup the same.

Those 2 cents spent, I'm OK with whatever the other reviewers decide. 😋

@n-rodriguez
Copy link
Contributor Author

@n-rodriguez the issue that you're trying to solve with this PR seems to be an issue (or misconfiguration) in your local development environment (perhaps can be solved with just a gem clean?).

Actually it's not really an issue with my environment but more a helper to provide to developers (senior or newbie).

Getting into Ruby and its ecosystem can be difficult for new comers. Forgetting a bundle exec can lead to unexpected issues such this one. IMHO adding a shortcut like bin/kitchen worth it.

@n-rodriguez
Copy link
Contributor Author

n-rodriguez commented May 13, 2019

@n-rodriguez the issue that you're trying to solve with this PR seems to be an issue (or misconfiguration) in your local development environment (perhaps can be solved with just a gem clean?).

It's more a bundler issue... Actually you shoud not call kitchen directly but call bundle exec kitchen.
When you run bundle exec kitchen, bundler reads your Gemfile and Gemfile.lock to determine your exact dependencies, that why it shout when you call kitchen directly.

Forgetting bundle exec is easy, that's why they provide binstub. Rails use the same feature for its own cli : rails/rails#35023

most probably, not 2 environments will be setup the same.

it's independant from environment.

it's a shortcut to bundle exec kitchen and it provides a clear guarantee that the kitchen command you're running via bin/kitchen is the one that goes with this particular formula.

Copy link
Member

@daks daks left a comment

Choose a reason for hiding this comment

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

I don't know that much Ruby dev environment and tools, so I'll trust @n-rodriguez on this (he knows Ruby well). What I understand here is that the 'magic' usually done by bundler sometimes fails and this binstubs thing is a way to forget about magic.

@myii
Copy link
Contributor

myii commented May 16, 2019

Thanks for creating the PR @n-rodriguez and to you both for taking the time to reply @javierbertoli and @daks. For reference, @n-rodriguez brought this up in Slack/IRC/Matrix room here. Just grabbing the salient parts here (with slight formatting adjustments):

- - -
22:17 nrodriguez about the kitchen command
22:17 nrodriguez it should be prefixed with bundle exec but the doc don't mention it
22:18 nrodriguez an other way of doing things is to use binstubs
22:18 nrodriguez https://github.com/saltstack-formulas/vault-formula#testing
22:20 nrodriguez you can have global and local binstubs
22:20 nrodriguez here i talk about local binstub
22:20 nrodriguez it's about adding a bin/kitchen in the repo
22:20 nrodriguez so you can do bin/kitchen verify foo
22:21 nrodriguez the bin/kitchen is a small wrapper produced by bundler to load the correct gem in the correct version specified in the Gemfile
22:21 myii[m] Would you mind making a draft PR on template-formula, so that we can open it up for discussion.
22:21 nrodriguez sure
22:23 myii[m] The idea sounds good but I want to discuss whether it's within the scope of what we offer with our formulas.
22:30 nrodriguez actually it's just a shortcut for bundle exe kitchen
22:30 nrodriguez bundle exec kitchen => bin/kitchen
22:32 myii[m] Personally, I like these sorts of things. But I find there are some useful viewpoints when opening it up for wider discussion.

I appreciate both sets of views. I also understand that configuring Ruby can be "fun". I've got some history with it but I was put off running kitchen locally for a long time, since I didn't want to have to check my environment first. Since our formulas are reliant on kitchen for testing, it makes sense to make things work out of the box. The more testing done locally before PRs are submitted, the better. Travis will be happy with us, too!

@n-rodriguez
Copy link
Contributor Author

Since our formulas are reliant on kitchen for testing, it makes sense to make things work out of the box. The more testing done locally before PRs are submitted, the better. Travis will be happy with us, too!

👍

@myii
Copy link
Contributor

myii commented May 25, 2019

@n-rodriguez Sorry for causing the conflict with #123! @javierbertoli Are you OK if we move forward with this?

@myii myii merged commit 1af73b1 into saltstack-formulas:master May 27, 2019
@myii
Copy link
Contributor

myii commented May 27, 2019

Thanks all for your input. This has been merged @n-rodriguez.

@myii myii mentioned this pull request May 27, 2019
@saltstack-formulas-travis

🎉 This PR is included in version 2.1.17 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

6 participants