Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update to use puppetcore puppet and facter #563

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gavindidrichsen
Copy link

@gavindidrichsen gavindidrichsen commented Mar 10, 2025

This change

  • Updates ruby to 3.2.5
  • Introduces a change to the Gemfile that enables a "switch" on PUPPET_AUTH_TOKEN environment variable. In other words, when not-set, then all gem dependencies will be resolved from https://rubygems.org. If set, then puppet and facter will be resolved from the https://rubygems-puppetcore.puppet.com

For instructions on how to setup authentication and consume the puppetcore gems, see https://github.com/puppetlabs/puppetcore-gems/blob/main/docs/how-to/how_to_consume_the_private_puppetcore_gems.md.

Also, see my testing below

This change
* Updates ruby to 3.2.5
*  Introduces a change to the Gemfile that enables a "switch" on PUPPET_AUTH_TOKEN environment variable.  In other words, when not-set, then all gem dependencies will be resolved from https://rubygems.org.  If set, then puppet and facter will be resolved from the https://rubygems-puppetcore.puppet.com

This commit enables the peadm development team to test its functionality using the puppetcore puppet and facter gems.

the  Signed-off-by: Gavin Didrichsen <gavin.didrichsen@gmail.com>
@gavindidrichsen
Copy link
Author

gavindidrichsen commented Mar 10, 2025

Verify bundle install WITHOUT PUPPET_AUTH_TOKEN set

This proves that the bundle install on the peadm should work as-before (apart from the upgrade to ruby 3) without pulling in any puppetcore gems:

# clear all existing ruby configuration
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ rgc
+ rm -f Gemfile.lock
+ rm -rf .bundle .direnv vendor/bundle vendor/bin vendor/gems
+ set +x

# setup local bundler configuration
bundle config --local gemfile Gemfile
bundle config --local path vendor/bundle
bundle config --local bin vendor/bin

# set local ruby to be 3.x because the new puppet requires ruby 3
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ rbenv local 3.2.5

# bundle install
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ bundle install
Your Gemfile lists the gem puppetlabs_spec_helper (~> 6.0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Fetching rake 13.2.1
Installing rake 13.2.1
...
...
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ bundle exec rspec spec/support/gemfile_spec.rb 

# verify the source for puppet and facter are https://rubygems.org
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ cat Gemfile.lock | grep -E "(remote:|specs:| puppet | facter | hiera )"
  remote: https://rubygems.org/
  specs:
      puppet (>= 6.18.0)
    facter (4.10.0)
      facter (< 5.0.0)
    puppet (8.10.0-universal-darwin)
      facter (>= 4.3.0, < 5)
      puppet (>= 6)
      puppet (>= 5)
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗

Verify bundle install WITH PUPPET_AUTH_TOKEN set

In other words, PUPPET_AUTH_TOKEN is set on the environment and is a valid Forge token

# clear everything ruby config
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ rgc
+ rm -f Gemfile.lock
+ rm -rf .bundle .direnv vendor/bundle vendor/bin vendor/gems
+ set +x
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ 

# setup local bundler configuration
bundle config --local gemfile Gemfile
bundle config --local path vendor/bundle
bundle config --local bin vendor/bin

# set the PUPPET_AUTH_TOKEN
export PUPPET_AUTH_TOKEN=<REDACTED_VALID_FORGE_TOKEN>

# add bundle authentication
bundle config --local https://rubygems-puppetcore.puppet.com "forge-key:${PUPPET_AUTH_TOKEN}"

# bundle install
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ bundle install
Your Gemfile lists the gem puppetlabs_spec_helper (~> 6.0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Fetching gem metadata from https://rubygems-puppetcore.puppet.com/..
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Fetching rake 13.2.1
...
...


# verify the gem source for puppet and facter is https://rubygems-puppetcore.puppet.com/
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ cat Gemfile.lock | grep -E "(remote:|specs:| puppet | facter | hiera )"
  remote: https://rubygems-puppetcore.puppet.com/
  specs:
    facter (4.11.0)
    puppet (8.11.0-universal-darwin)
      facter (>= 4.3.0, < 5)
  remote: https://rubygems.org/
  specs:
      puppet (>= 6.18.0)
      facter (< 5.0.0)
      puppet (>= 6)
      puppet (>= 5)
  facter (~> 4.0)!
  puppet (~> 8.11)!
➜  puppetlabs-peadm git:(gavin_puppetcore_update) ✗ 

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant