Building our Jenkinsfile

The Pipeline plugin we installed on our Jenkins node allows us to declare our pipeline directly in the same repository as our code, as a script called a Jenkinsfile. This Jenkinsfile describes the details of our build steps, which can be automatically read by Jenkins to execute our build. We'll begin with a very simple Jenkinsfile that checks to make sure that all of our manifests pass a puppet parser validate:

pipeline {    agent any    stages {        stage('Test') {            steps {                sh 'find manifests -name *.pp -exec /usr/local/bin/puppet parser validate {} +;'            }        }    }}

This Jenkinsfile describes a pipeline that can be run on any agent (we only have one: our Jenkins node). It has stages, but only a single stage named Test, with a single ...

Get Mastering Puppet 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.