Skip to content

Instantly share code, notes, and snippets.

@velocity303
Last active January 4, 2017 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velocity303/7810f7277e424fcba131b9f6320af636 to your computer and use it in GitHub Desktop.
Save velocity303/7810f7277e424fcba131b9f6320af636 to your computer and use it in GitHub Desktop.
Jenkinsfile for Puppet Testing with Pipeline Plugin
node {
stage ('Checkout Control Repo') {
git url: 'https://github.com/velocity303/demo-control-repo.git', branch: 'production'
}
stage ('Check Style') {
sh 'echo $(find . -type f -name "*.pp" \\( -exec /opt/puppetlabs/puppet/bin/puppet-lint --with-filename {} \\; -o -quit \\) 2>&1 ) | grep -v ERROR'
}
stage ('Check Syntax') {
sh 'echo $(find . -type f -name "*.pp" \\( -exec /opt/puppetlabs/bin/puppet parser validate {} \\; -o -quit \\) 2>&1 ) | grep -v Error'
}
stage ('Authorize deployment') {
puppet.credentials 'pe-access-token'
}
stage ('Deploy to production') {
puppet.codeDeploy 'production'
}
stage ('Deploy change to production') {
puppet.job 'production', query: 'nodes { catalog_environment = "production" }'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment