Skip to content

Commit 4eb3dc4

Browse files
committed
Initial commit.
0 parents  commit 4eb3dc4

14 files changed

+491
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.*.sw?
2+
/stats/
3+
/vendor
4+
/.bundle
5+
/Gemfile.lock

About.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!SLIDE >
2+
# What is PDK?
3+
4+
The Puppet Development Kit (PDK) is an All-In-One set of tools for developing and testing Puppet modules.
5+
6+
PDK includes a bundled version of Ruby plus various gems and utilities required for creating and testing Puppet modules.
7+
8+
[PDK was announced](https://puppet.com/blog/develop-modules-faster-new-puppet-development-kit) in August of 2017 with
9+
the goal of making it easier to build high-quality Puppet modules that follow best practices and use the available
10+
testing frameworks to avoid deploying bad code to live infrastructure.
11+
12+
<!SLIDE >
13+
# Installation
14+
15+
PDK packages for various Linux distributions, Windows, and MacOS X can be downloaded from
16+
[https://puppet.com/download-puppet-development-kit](https://puppet.com/download-puppet-development-kit).
17+
18+
~~~SECTION:handouts~~~
19+
20+
* https://puppet.com/docs/pdk/latest/pdk.html
21+
22+
~~~ENDSECTION~~~
23+
24+
~~~SECTION:notes~~~
25+
26+
There are no Fedora packages (yet), but the RHEL/CentOS packages mostly Just Work(TM).
27+
28+
~~~ENDSECTION~~~

Customizing.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!SLIDE >
2+
# PDK Templates
3+
4+
The default PDK templates can be found here:
5+
6+
https://github.com/puppetlabs/pdk-templates
7+
8+
Files in the ***moduleroot\_init*** directory are created only if they don't exist.
9+
10+
Files in the ***moduleroot*** directory will replace any existing file when you run
11+
`pdk update` or `pdk convert`.
12+
13+
Files in the ***object\_templates*** directory are used by the various `pdk new`
14+
commands.
15+
16+
The default settings for the template output can be found in the file
17+
***[config_defaults.yml](https://github.com/puppetlabs/pdk-templates/blob/master/config_defaults.yml)***.
18+
19+
<!SLIDE >
20+
# Customizing Template Output
21+
22+
Settings in the file ***.sync.yml*** in the root of your module can be used to
23+
customize the output of the templates.
24+
25+
***.sync.yml*** contains a hash. The keys of the hash are the names of the generated
26+
files. The exact values can be found by looking at the
27+
[PDK templates ***README.md***](https://github.com/puppetlabs/pdk-templates/blob/master/README.md),
28+
[***config_defaults.yml*** in the templates](https://github.com/puppetlabs/pdk-templates/blob/master/config_defaults.yml),
29+
and the code of the templates.
30+
31+
After updating ***.sync.yml***, run `pdk update` to regenerate files from the templates.
32+
33+
<!SLIDE >
34+
# Example ***.sync.yml***
35+
36+
@@@ yaml
37+
---
38+
Gemfile:
39+
optional:
40+
':acceptance':
41+
- gem: beaker
42+
- gem: beaker-rspec
43+
- gem: beaker-puppet_install_helper
44+
- gem: beaker-module_install_helper
45+
- gem: vagrant-wrapper
46+
.gitignore:
47+
paths:
48+
- /update_report.txt
49+
spec/spec_helper.rb:
50+
spec_overrides: |-
51+
# Add coverage report.
52+
RSpec.configure do |c|
53+
c.after(:suite) do
54+
RSpec::Puppet::Coverage.report!
55+
end
56+
end
57+

Future.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!SLIDE >
2+
# Future of PDK
3+
4+
PDK has experimental support for creating a new provider with `pdk new provider`.
5+
See https://github.com/puppetlabs/puppet-resource_api#getting-started for more information.
6+
7+
Other interesting features that may be coming soon:
8+
9+
* More module features
10+
* `pdk new function` [PDK-700](https://tickets.puppetlabs.com/browse/PDK-700)
11+
* `pdk new fact` [PDK-683](https://tickets.puppetlabs.com/browse/PDK-683)
12+
* Multi-Puppet Support [PDK-414](https://tickets.puppetlabs.com/browse/PDK-414)
13+
* Support for additional platforms [PDK-399](https://tickets.puppetlabs.com/browse/PDK-399)
14+
* Testing on multiple Puppet and Ruby versions
15+
[PDK-785](https://tickets.puppetlabs.com/browse/PDK-785),
16+
[PDK-840](https://tickets.puppetlabs.com/browse/PDK-840), etc.
17+
* Data in modules by default [PDK-908](https://tickets.puppetlabs.com/browse/PDK-908)
18+
* CLI ability to update ***metadata.json*** [PDK-878](https://tickets.puppetlabs.com/browse/PDK-873)
19+
* Improved CI/CD support [PDK-477](https://tickets.puppetlabs.com/browse/PDK-477)
20+
* Control repo support [PDK-564](https://tickets.puppetlabs.com/browse/PDK-564),
21+
[puppetlabs/pdk#333](https://github.com/puppetlabs/pdk/issues/333)
22+
* [Bundled git support](https://github.com/puppetlabs/pdk/pull/331)

Gemfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'showoff'
4+
5+
group :development do
6+
gem 'puppet'
7+
end
8+
9+
group :optional do
10+
gem 'pdfkit'
11+
end

MoreInfo.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!SLIDE >
2+
# For More Information...
3+
4+
* PDK
5+
* https://puppet.com/download-puppet-development-kit
6+
7+
* Onyx Point
8+
* https://onyxpoint.com/
9+
* https://simp-project.com/
10+
11+
* Me
12+
* https://twitter.com/silug
13+
* https://github.com/silug

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Intro to PDK
2+
3+
This is a presentation originally prepared for the [St. Louis Puppet Users Group meeting on 2018-04-16](https://www.meetup.com/St-Louis-Puppet-User-Group/events/249191562/).
4+
5+
## Setting up showoff
6+
7+
```
8+
bundle install --path=vendor
9+
```
10+
11+
## Running presentation
12+
13+
```
14+
bundle exec showoff serve
15+
```
16+
17+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
18+
19+
Code examples may be reused under the terms of the Apache 2.0 license.

Testing.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!SLIDE >
2+
# Testing
3+
4+
Smoke tests (simple `lint`, `rubocop`, and parser checks) can be run with the
5+
following command:
6+
7+
@@@ Console nochrome
8+
$ pdk validate
9+
10+
Unit tests (Ruby scripts that use [rspec-puppet](http://rspec-puppet.com/)
11+
to test the contents of a compiled catalog) can be executed with the
12+
following command:
13+
14+
@@@ Console nochrome
15+
$ pdk test unit
16+
17+
The default tests use
18+
[rspec-puppet-facts](https://github.com/mcanevet/rspec-puppet-facts)
19+
to test catalog compilation on each supported OS.
20+
21+
~~~SECTION:handouts~~~
22+
23+
https://puppet.com/docs/pdk/1.x/pdk_testing.html
24+
25+
~~~ENDSECTION~~~
26+
27+
<!SLIDE >
28+
# `pdk bundle`
29+
30+
PDK allows you to run arbitrary `bundle` commands with `pdk bundle`.
31+
For example, to see what `rake` tasks are available, you can run the
32+
following command:
33+
34+
@@@ Console nochrome
35+
$ pdk bundle exec rake -- -T
36+
37+
To see all output of the `rake` tasks run by `pdk test unit`, you can
38+
run the following command:
39+
40+
@@@ Console nochrome
41+
$ pdk bundle exec rake spec
42+
43+
<!SLIDE >
44+
# Acceptance Tests
45+
46+
Acceptance tests spin up VMs or Docker containers to test the behavior of a
47+
module on a live system.
48+
49+
PDK currently has no direct support for acceptance tests, but if you have an
50+
existing module with working tests, you should be able to make some minor
51+
additions to ***Gemfile*** and run the following:
52+
53+
@@@ Console nochrome
54+
$ pdk bundle exec rake beaker
55+
56+
For more information on acceptance tests, see the following:
57+
58+
* [beaker-rspec](https://github.com/puppetlabs/beaker-rspec)
59+
* [beaker](https://github.com/puppetlabs/beaker)
60+
* [Serverspec](http://serverspec.org/)

Title.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!SLIDE center>
2+
<div id="title">
3+
Intro to PDK
4+
</div>
5+
<div>
6+
<br />
7+
Steven Pritchard<br />
8+
Onyx Point
9+
</div>
10+
11+
<!SLIDE >
12+
# Welcome to _Intro to PDK_!
13+
14+
<p>
15+
<img src="../_images/OnyxPoint-logo.png" alt="Onyx Point, Inc." style="width: 200px;" align="left"/>
16+
<br/><br/><br/>
17+
</p>
18+
19+
* [System Integrity Management Platform (SIMP)](https://simp-project.com/) Open Source stewards
20+
* DevOps, Compliance, and Automation consulting
21+
* Professional services for SIMP, Puppet, Red Hat®, and GitLab
22+
* Puppet Gold Partners
23+
24+
## **Steven Pritchard**
25+
26+
* Senior Consultant
27+
* Puppet Certified Professional (2017)
28+
* Linux and Open Source geek for over 20 years
29+
* [Southern Illinois Linux Users Group](http://www.silug.org/)
30+
* [Vim Geeks](http://vimgeeks.org/)
31+
32+
~~~SECTION:notes~~~
33+
34+
* Engineers focus on Security, System Administration, Automation, and DevOps
35+
consulting for government and commercial clients
36+
* Offer professional services for DevOps Workflow, Puppet, Red Hat®, SIMP, and GitLab
37+
* Avid supporters of Open Source and open standards in technology
38+
* Puppet is an Open Source software configuration management tool.
39+
* Runs on many Unix-like systems and Microsoft Windows
40+
* Includes its own declarative language to describe system configuration
41+
* SIMP is a framework built with Puppet to manage and automate Compliance
42+
43+
~~~ENDSECTION~~~

Using.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!SLIDE >
2+
# Creating a Module - The Old Way
3+
4+
@@@ Console nochrome
5+
$ puppet module generate author-modulename --skip-interview
6+
$ cd modulename
7+
8+
*...Lots of editing...*
9+
10+
@@@ Console nochrome
11+
$ puppet module build
12+
13+
*...Upload to Forge...*
14+
15+
<!SLIDE >
16+
# What's Wrong With the Old Way?
17+
18+
* Module skeleton quality varied wildly.
19+
* Often easier to create everything from scratch.
20+
* The skeleton was only used as an initial template.
21+
* `puppet module generate` [was deprecated in Puppet 5.4.0](https://puppet.com/docs/puppet/5.4/release_notes.html#deprecations).
22+
23+
<!SLIDE >
24+
# Creating a Module - The New Way
25+
26+
@@@ Console nochrome
27+
$ pdk new module author-modulename
28+
$ cd modulename
29+
$ pdk new class modulename
30+
31+
*...Lots of editing...*
32+
33+
@@@ Console nochrome
34+
$ pdk validate
35+
$ pdk test unit
36+
$ pdk build
37+
38+
*...Upload to Forge...*
39+
40+
<!SLIDE >
41+
# Why is this better?
42+
43+
* Generated code follows best practices.
44+
* `pdk new class classname` creates ***manifests/classname.pp*** *and* ***spec/classes/classname_spec.rb***.
45+
* Testing out of the box!
46+
* The default templates (https://github.com/puppetlabs/pdk-templates) include lots of goodies:
47+
* CI configurations for Travis CI, GitLab CI/CD, and AppVeyor
48+
* *operatingsystem_support* and *requirements* in ***metadata.json***
49+
* Git configuration (***.gitignore***, ***.gitattributes***)
50+
* [Puppet Strings](https://github.com/puppetlabs/puppet-strings) in generated code
51+
* Updates to the templates can be applied to (some files in) the module.
52+
* Interaction with Ruby tooling (`bundle`, `rake`) is not required.
53+
* Did I mention that `puppet module generate` [was deprecated in Puppet 5.4.0](https://puppet.com/docs/puppet/5.4/release_notes.html#deprecations)?
54+
55+
<!SLIDE >
56+
# Using PDK
57+
58+
## Create a new module
59+
60+
@@@ Console nochrome
61+
$ pdk new module mynewmodule
62+
63+
(Or you can skip the interview...)
64+
65+
@@@ Console nochrome
66+
$ pdk new module mynewmodule --skip-interview
67+
68+
## Convert an existing module to PDK format
69+
70+
@@@ Console nochrome
71+
$ pdk convert
72+
73+
*(Note that this does not add tests for existing classes, defined types, etc.)*
74+
75+
## Update from the templates in an existing PDK-format module
76+
77+
@@@ Console nochrome
78+
$ pdk update
79+
80+
<!SLIDE >
81+
# Using PDK
82+
83+
## Create a new class
84+
85+
@@@ Console nochrome
86+
$ pdk new class classname
87+
88+
## Create a new defined type
89+
90+
@@@ Console nochrome
91+
$ pdk new defined_type typename
92+
93+
## Create a new task
94+
95+
@@@ Console nochrome
96+
$ pdk new task taskname

_images/OnyxPoint-logo.png

15.2 KB
Loading

_images/favicon.ico

14.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)