README.md in puppet-check-2.0.1 vs README.md in puppet-check-2.1.0

- old
+ new

@@ -1,7 +1,7 @@ # Puppet Check -[![Build Status](https://travis-ci.org/mschuchard/puppet-check.svg?branch=master)](https://travis-ci.org/mschuchard/puppet-check) +[![Build Status](https://travis-ci.com/mschuchard/puppet-check.svg?branch=master)](https://travis-ci.com/mschuchard/puppet-check) [![CircleCI](https://circleci.com/gh/mschuchard/puppet-check.svg?style=svg)](https://circleci.com/gh/mschuchard/puppet-check) - [Description](#description) - [Usage](#usage) - [CLI](#cli) @@ -123,12 +123,15 @@ ``` ### What About Puppet Development Kit? The fairly recent release of the Puppet Development Kit (PDK) will hopefully eventually bring about the capability to test and validate your Puppet code and data in a streamlined, efficient, comprehensive, and accurate fashion comparable to Puppet Check. Unfortunately, the PDK has not yet achieved feature or efficiency parity with Puppet Check. The goal is for the PDK to one day replace Puppet Check and for Puppet Check to enter maintenance mode, but for now Puppet Check is still needed to lead Puppet testing. +### What About PDK now? +As of version 2.4.0 of the PDK, the PDK has essentially more or less achieved feature parity with Puppet Check. Although the PDK is not as efficient (including especially that Puppet Check executes significantly faster), it is still supported by Puppetlabs. Therefore, if you need an efficient and comprehensive Puppet validation solution, then you can still utilize Puppet Check, but the PDK is a recommended alternative for the future. + ## Usage -Please see the [Gemspec](puppet-check.gemspec) for dependency information. All other dependencies should be fine with various versions. Puppet Check can be used with a CLI, Rake tasks, or API, from your system, rbenv, rvm, Docker, or Vagrant. Please note all interfaces (API by default, but can be modified) will ignore any directories named `fixtures` or specified paths with that directory during file checks and spec tests. +Please see the [Gemspec](puppet-check.gemspec) for dependency information. All other dependencies should be fine with various versions. Puppet Check can be used with a CLI, Rake tasks, or API, from your system, rbenv, rvm, Docker, or Vagrant. Please note all interfaces (API by default, but can be modified) will ignore any directories named `fixtures`, or specified paths with that directory during file checks and spec tests. ### CLI ``` usage: puppet-check [options] paths --version Display the current version. @@ -276,49 +279,49 @@ task.pattern = Dir.glob('**/{classes,defines,facter,functions,hosts,puppet,unit,types}/**/*_spec.rb').reject { |dir| dir =~ /fixtures/ } ``` ### Docker -You can also use Puppet Check inside of Docker for quick, portable, and disposable testing. Below is an example Dockerfile for this purpose: +You can also use Puppet Check inside of Docker for quick, portable, and disposable testing. Below is an example `Dockerfile` for this purpose: ```dockerfile -# a reliable and small container at the moment -FROM ubuntu:18.04 +# a reliable and small container; today should maybe use ruby:slim instead +FROM ubuntu:20.04 # you need ruby and any other extra dependencies that come from packages; in this example we install git to use it for downloading external module dependencies RUN apt-get update && apt-get install ruby git -y -# you need puppet-check and any other extra dependencies that come from gems; in this example we install reek because the ruby ABI is 2.3 and then rspec-puppet and rake for extra testing -RUN gem install --no-document puppet-check reek rspec-puppet rake +# you need puppet-check and any other extra dependencies that come from gems; in this example we install rspec-puppet and rake for extra testing +RUN gem install --no-document puppet-check rspec-puppet rake # this is needed for the ruby json parser to not flip out on fresh os installs for some reason (change encoding value as necessary) ENV LANG en_US.UTF-8 # create the directory for your module, directory environment, etc. and change directory into it WORKDIR /module_name_or_directory_environment_name # copy the module, directory environment, etc. contents into the corresponding directory inside the container; alternative, bind a volume mount for your module(s) into the container at runtime COPY / . # execute your tests; in this example we are executing the full suite of tests ENTRYPOINT ["rake", "puppetcheck"] ``` -You can also build your own general container for testing various Puppet situations by removing the last three lines. You can then test each module, directory environment, etc. on top of that container by merely adding and modifying the final three lines to a Dockerfile that uses the container you built from the first four lines. This is recommended usage due to being very efficient and stable. +You can also build your own general container image for testing various Puppet situations by removing the last three lines. You can then test each module, directory environment, etc. on top of that container by merely adding and modifying the final three lines to a `Dockerfile` that uses the container you built from the first four lines. This is recommended usage due to being very efficient and stable. As an alternative to copying Puppet code and data into the image for testing, it is also recommended to bind volume mount the container to the directory with your Puppet code and data. ### Vagrant -As an alternative to Docker, you can also use Vagrant for quick and disposable testing, but it is not as portable as Docker for these testing purposes. Below is an example Vagrantfile for this purpose. +As an alternative to Docker, you can also use Vagrant for quick and disposable testing, but it is not as portable as Docker for these testing purposes. Below is an example `Vagrantfile` for this purpose. ```ruby Vagrant.configure(2) do |config| # a reliable and small box at the moment - config.vm.box = 'fedora/26-cloud-base' + config.vm.box = 'fedora/35-cloud-base' config.vm.provision 'shell', inline: <<-SHELL # cd to '/vagrant' cd /vagrant # you need ruby and any other extra dependencies that come from packages; in this example we install git to use it for downloading external module dependencies sudo dnf install ruby rubygems git -y - # you need puppet-check and any other extra dependencies that come from gems; in this example we install reek because the ruby ABI is 2.2 and then rspec-puppet and rake for extra testing - sudo gem install --no-document puppet-check reek rspec-puppet rake + # you need puppet-check and any other extra dependencies that come from gems; in this example we install rspec-puppet and rake for extra testing + sudo gem install --no-document puppet-check rspec-puppet rake # this is needed for the ruby json parser to not flip out on fresh os installs for some reason (change encoding value as necessary) export LANG='en_US.UTF-8' # execute your tests; in this example we are executing the full suite of tests rake puppetcheck SHELL @@ -328,10 +331,10 @@ To overcome the lack of convenient portability, you could try spinning up the Vagrant instance at the top level of your Puppet code and data and then descend into directories to execute tests as necessary. Cleverness or patience will be necessary if you decide to use Vagrant for testing and desire portability. ### Exit Codes - 0: PuppetCheck exited with no internal exceptions or errors in your code and data. - 1: PuppetCheck exited with an internal exception (takes preference over other non-zero exit codes) or failed spec test(s). -- 2: PuppetCheck exited with one or more errors in your code and data. Alternatively, PuppetCheck exited with one or more warnings in your code and data and you specified to fail on warnings. +- 2: PuppetCheck exited with one or more errors in your code and data. Alternatively, PuppetCheck exited with one or more warnings in your code and data, and you specified to fail on warnings. ### Optional Dependencies - **rake** (gem): install this if you want to use Puppet Check with `rake` tasks in addition to the CLI. - **rspec** (gem): install this if you want to use Puppet Check to execute the spec tests for your Ruby files during `rake`. - **rspec-puppet** (gem): install this if you want to use Puppet Check to execute the spec tests for your Puppet files during `rake`.