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

(#764) Ensure --puppet-dev checkout is always updated #792

Merged
merged 1 commit into from
Oct 29, 2019

Conversation

rodjek
Copy link
Contributor

@rodjek rodjek commented Oct 28, 2019

The original issue was that pdk console --puppet-dev didn't update the
checkout before using it. This is because the CLI for pdk console
didn't call PDK::Util::PuppetVersion.fetch_puppet_dev. Rather than add
that, I've opted to add this call to the logic in
PDK::CLI::Util.puppet_from_opts_or_env so that it happens
automatically when setting up the environment for puppet-dev.


First run to seed the checkout

$ pdk console --puppet-dev
pdk (WARN): Module fixtures not found, please run pdk bundle exec rake spec_prep.
[✔] Installing missing Gemfile dependencies.
Ruby Version: 2.4.7
Puppet Version: 6.10.1
Puppet Debugger Version: 0.15.1
Created by: NWOps <corey@nwops.io>
Type "commands" for a list of debugger commands
or "help" to show the help screen.

1:>>

Manually switch the checkout to Puppet 6.9.0

$ git -C ~/.pdk/cache/src/puppet checkout 6.9.0
Note: switching to '6.9.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c2ccdd4efe Merge pull request #7706 from gimmyxd/PUP-10016

Second run, showing that the checkout has been updated to the HEAD of
origin/master (at time of writing, Puppet 6.10.1)

$ pdk console --puppet-dev
pdk (WARN): Module fixtures not found, please run pdk bundle exec rake spec_prep.
[✔] Installing missing Gemfile dependencies.
Ruby Version: 2.4.7
Puppet Version: 6.10.1
Puppet Debugger Version: 0.15.1
Created by: NWOps <corey@nwops.io>
Type "commands" for a list of debugger commands
or "help" to show the help screen.

1:>>

Fixes #764

@rodjek rodjek added this to the November 2019 milestone Oct 28, 2019
@rodjek rodjek requested a review from a team as a code owner October 28, 2019 04:35
@coveralls
Copy link

coveralls commented Oct 28, 2019

Coverage Status

Coverage decreased (-0.02%) to 91.767% when pulling eac401b on rodjek:gh-764 into 18d814d on puppetlabs:master.

lib/pdk/cli/util.rb Outdated Show resolved Hide resolved
The original issue was that `pdk console --puppet-dev` didn't update the
checkout before using it. This is because the CLI for `pdk console`
didn't call `PDK::Util::PuppetVersion.fetch_puppet_dev`. Rather than add
that, I've opted to add this call to the logic in
`PDK::CLI::Util.puppet_from_opts_or_env` so that it happens
automatically when setting up the environment for puppet-dev.

---

First run to seed the checkout
```
$ pdk console --puppet-dev
pdk (WARN): Module fixtures not found, please run pdk bundle exec rake spec_prep.
[✔] Installing missing Gemfile dependencies.
Ruby Version: 2.4.7
Puppet Version: 6.10.1
Puppet Debugger Version: 0.15.1
Created by: NWOps <corey@nwops.io>
Type "commands" for a list of debugger commands
or "help" to show the help screen.

1:>>
```

Manually switch the checkout to Puppet 6.9.0
```
$ git -C ~/.pdk/cache/src/puppet checkout 6.9.0
Note: switching to '6.9.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c2ccdd4efe Merge pull request #7706 from gimmyxd/PUP-10016
```

Second run, showing that the checkout has been updated to the HEAD of
origin/master (at time of writing, Puppet 6.10.1)
```
$ pdk console --puppet-dev
pdk (WARN): Module fixtures not found, please run pdk bundle exec rake spec_prep.
[✔] Installing missing Gemfile dependencies.
Ruby Version: 2.4.7
Puppet Version: 6.10.1
Puppet Debugger Version: 0.15.1
Created by: NWOps <corey@nwops.io>
Type "commands" for a list of debugger commands
or "help" to show the help screen.

1:>>
```

Fixes puppetlabs#764
@glennsarti glennsarti merged commit 57271d9 into puppetlabs:master Oct 29, 2019
@rodjek rodjek deleted the gh-764 branch October 30, 2019 07:35
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 console --puppet-dev does not grab latest Puppet source
4 participants