Using .sync.yml in Puppet Development Kit (PDK)

August 9, 2022 – Samuli Seppänen

Puppet Development Kit is probably the best thing since sliced bread if you work a lot with Puppet. It makes adding basic validation and unit tests trivial with help from rspec-puppet. It also makes it very easy to build module packages for the Puppet Forge.

That said, there is a minor annoyance with it: whenever you run "pdk update" to update PDK to the latest version, all your local changes to files such as .gitignore get destroyed, because PDK creates those files from PDK templates and any local changes are mercilessly wiped. Fortunately there is a way to sync your local changes to the files generated from the templates with .sync.yml. While .sync.yml is is pretty well documented, documentation is lots and lots of words with very few examples. So, here's a fairly trivial .sync.yml example that ensures local changes to .pdkignore and .gitignore persist across PDK updates:

    - '*.log'
    - '*.log'

In PDK template speak .gitignore and .pdkignore are namespaces. For a list of namespaces see the official documentation.

Want to talk to an expert?

If you want to reach us, just send us a message or book a free call!