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

Allow pdk convert and pdk update to work in a ControlRepo context #1310

Merged

Conversation

garrettrowell
Copy link
Contributor

@garrettrowell garrettrowell commented Jan 24, 2024

Summary

Allow pdk convert and pdk update commands to be ran if PDK_FEATURE_FLAGS=controlrepo set.

Current Behavior

$ git clone https://github.com/puppetlabs/control-repo
$ cd control-repo
$ PDK_FEATURE_FLAGS=controlrepo pdk convert
pdk (ERROR): `pdk convert` can only be run from inside a valid module directory.

Expected Behavior

$ git clone https://github.com/puppetlabs/control-repo
$ cd control-repo
$ PDK_FEATURE_FLAGS=controlrepo pdk convert

We need to create the metadata.json file for this module, so we're going to ask you 4 questions.
If the question is not applicable to this module, accept the default option shown after each question. You can modify any answers at any time by manually updating the metadata.json file.

[Q 1/4] If you have a Puppet Forge username, add it here.
We can use this to upload your module to the Forge when it's complete.
--> garrettrowell

[Q 2/4] Who wrote this module?
This is used to credit the module's author.
--> Garrett Rowell

[Q 3/4] What license does this module code fall under?
This should be an identifier from https://spdx.org/licenses/. Common values are "Apache-2.0", "MIT", or "proprietary".
--> Apache-2.0

[Q 4/4] What operating systems does this module support?
Use the up and down keys to move between the choices, space to select and enter to continue.
--> RedHat based Linux, Debian based Linux, Windows


------------Files to be added-----------
/Users/garrett.rowell/workspace/control-repo/metadata.json
/Users/garrett.rowell/workspace/control-repo/.gitattributes
/Users/garrett.rowell/workspace/control-repo/.pdkignore
/Users/garrett.rowell/workspace/control-repo/.puppet-lint.rc
/Users/garrett.rowell/workspace/control-repo/.rspec
/Users/garrett.rowell/workspace/control-repo/.rubocop.yml
/Users/garrett.rowell/workspace/control-repo/.vscode/extensions.json
/Users/garrett.rowell/workspace/control-repo/.yardopts
/Users/garrett.rowell/workspace/control-repo/Gemfile
/Users/garrett.rowell/workspace/control-repo/Rakefile
/Users/garrett.rowell/workspace/control-repo/spec/default_facts.yml
/Users/garrett.rowell/workspace/control-repo/spec/spec_helper.rb
/Users/garrett.rowell/workspace/control-repo/.fixtures.yml
/Users/garrett.rowell/workspace/control-repo/.sync.yml
/Users/garrett.rowell/workspace/control-repo/CHANGELOG.md

----------Files to be modified----------
/Users/garrett.rowell/workspace/control-repo/.gitignore

----------------------------------------

You can find a report of differences in convert_report.txt.

pdk (INFO): Module conversion is a potentially destructive action. Ensure that you have committed your module to a version control system or have a backup, and review the changes above before continuing.
Do you want to continue and make these changes to your module? yes

Workaround this PR Eliminates

This is teadious as I typically have the feature flags set in my .bash_profile and need to remember to unset it anytime I run pdk convert or pdk update in a control-repo

$ git clone https://github.com/puppetlabs/control-repo
$ cd control-repo
$ pdk convert
$ PDK_FEATURE_FLAGS=controlrepo pdk validate

@garrettrowell garrettrowell requested a review from a team as a code owner January 24, 2024 17:09
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ff3fac4) 88.50% compared to head (2aa52df) 88.51%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1310   +/-   ##
=======================================
  Coverage   88.50%   88.51%           
=======================================
  Files         133      133           
  Lines        5664     5666    +2     
=======================================
+ Hits         5013     5015    +2     
  Misses        651      651           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@garrettrowell garrettrowell force-pushed the control_repo_convert_update branch from 023ed81 to dec5e3e Compare January 25, 2024 16:56
@garrettrowell garrettrowell force-pushed the control_repo_convert_update branch from 0b367ad to 2aa52df Compare February 14, 2024 01:30
Copy link
Contributor

@jordanbreen28 jordanbreen28 left a comment

Choose a reason for hiding this comment

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

Great stuff. Thanks @garrettrowell!

@jordanbreen28 jordanbreen28 merged commit 0d6e6de into puppetlabs:main Feb 16, 2024
10 checks passed
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.

2 participants