Git tags and versioning

Git tags are used to create a permanent state of code and separate it from the existing branches. Tags are not intended to be iterated upon, but rather, should be used as a marker in time for the state of the code. This makes tags a perfect fit for the release versioning of Puppet code. We can create tags from any branch, but the master is the most common branch to cut release tags from. We can simply use the git tag command on our module repository to create a snapshot with a semantic version number and push it to the origin repository, to be called on by r10k or Code Manager. The workflow for a Git tag is also short, as follows:

  1. Check out the target branch (usually the master) for the tag (git checkout)
  2. Version the code (git tag)
  3. Push the tag to the remote repository (git push):
rary at Ryans-MBP in ~/workspace/packt/module (master)
$ git tag 'v1.4'

$ git tag -l
v1.4

$ git push origin v1.4

After our module has been properly versioned, we can edit the production-like Puppetfile to utilize our tag, rather than point to a particular development or master branch:

# Production-like branch, tagged with a solid version number
forge https://forge.puppetlabs.com

mod 'module',
git => '[email protected]:puppet/module.git',
tag => 'v1.4'

This is a simple version of the Puppet workflow, but it still leaves room for improvement. Puppet recently released a tool called the PDK, to help facilitate quality Puppet tooling into your workflow.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.193.158