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

Convert to Puppet 4 conventions #9

Closed
edestecd opened this issue Sep 14, 2017 · 6 comments
Closed

Convert to Puppet 4 conventions #9

edestecd opened this issue Sep 14, 2017 · 6 comments

Comments

@edestecd
Copy link
Owner

Use a puppetlabs module as an example and for god sakes use module sync!

@bittner
Copy link
Contributor

bittner commented Oct 20, 2017

$ pdk new module software

References

@edestecd
Copy link
Owner Author

Yea, I learned all about pdk at puppetconf! It looks nice and should solve some of our problems.

@bittner
Copy link
Contributor

bittner commented Oct 25, 2017

When you use PDK to generate an example Puppet module (e.g. pdk new module software) you can use the generated Gemfile with the generated Puppet version requirement. That will make pdk validate work immediately. I just tried it.

diff --git a/metadata.json b/metadata.json
index 1556c97..7bf2975 100644
--- a/metadata.json
+++ b/metadata.json
@@ -43,7 +43,7 @@
   "requirements": [
     {
       "name": "puppet",
-      "version_requirement": ">= 3.0.0 < 5.0.0"
+      "version_requirement": ">= 4.5.0 < 6.0.0"
     }
   ]
 }

The main complaint is "software not in autoload module layout", which goes away when I rename the puppet-software folder that I have cloned your repo into to just software. Then only a few validation complaints remain:

Linting

$ pdk validate
pdk (INFO): Running all available validators...
[✔] Checking metadata syntax (metadata.json tasks/*.json).
[✔] Checking module metadata style (metadata.json).
[✔] Checking Puppet manifest syntax (**/**.pp).
[✔] Checking Puppet manifest style (**/*.pp).
[✔] Checking Ruby code style (**/**.rb).
info: task-metadata-lint: ./: Target does not contain any files to validate (tasks/*.json).
warning: puppet-lint: manifests/social/skype.pp:37:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/social/slack.pp:31:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/virtualization/virtualbox.pp:48:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/virtualization/virtualbox.pp:50:27: arrow should be on the right operand's line
warning: puppet-lint: manifests/editors/atom.pp:46:9: arrow should be on the right operand's line
warning: puppet-lint: manifests/editors/atom.pp:68:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/browsers/chrome.pp:46:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/drivers/lanier_mpc5503.pp:32:9: arrow should be on the right operand's line
warning: puppet-lint: manifests/storage/drive.pp:39:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/utilities/iterm.pp:31:9: arrow should be on the right operand's line
warning: puppet-lint: manifests/utilities/alfred.pp:35:9: arrow should be on the right operand's line
warning: puppet-lint: manifests/utilities/alfred.pp:55:33: arrow should be on the right operand's line
warning: puppet-lint: manifests/utilities/controlplane.pp:31:9: arrow should be on the right operand's line
warning: puppet-lint: manifests/utilities/onyx.pp:30:11: arrow should be on the right operand's line

Tests

Tests work all out of the box: (A little more verbosity wouldn't hurt, but they all seem to be executed and pass.)

$ pdk test unit
[✔] Preparing to run the unit tests.
[✔] Running unit tests.
  Evaluated 165 tests in 5.57427871 seconds: 0 failures, 0 pending.
[✔] Cleaning up after running unit tests.

Travis CI

I have described in puppetlabs/pdk#324 (comment) how to download and install PDK for CI builds. Afterwards, all there is to do, clearly, is run the two commands pdk validate and pdk test unit, and optionally silence stderr (as discussed in puppetlabs/pdk#323).

@bittner
Copy link
Contributor

bittner commented Dec 5, 2017

NOTE: We're now using the mathow/centos-puppet-pdk Docker image for GitLab CI builds with PDK, as long as there is no official PDK Docker image yet, which is still in the making according to Puppetlabs officials:

# FILE: .gitlab-ci.yml

validate:
  stage: build
  image: mathow/centos-puppet-pdk
  script:
    - pdk validate 2> /dev/null

rspec:
  stage: test
  image: mathow/centos-puppet-pdk
  script:
    - pdk test unit 2> /dev/null

@edestecd
Copy link
Owner Author

edestecd commented Dec 5, 2017

very cool! Were also using gitlab ci with docker and this would be great!

@bittner
Copy link
Contributor

bittner commented Dec 7, 2017

I've now added a similar configuration for Travis to PR #15. Would you mind merging?

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

No branches or pull requests

2 participants