Jenkinsfile

I'm adding two new objects to our Jenkinsfile: an integration test provided by a shell script, and a post action that tells Jenkins to clean up our workspace. We're using an external script instead of running inline for ease of management, as each sh step is an independent shell in Jenkins. Our post cleanup action just makes sure that we don't retain any artifacts from a previous build:

pipeline {    agent any    stages {        stage('Validate') {            steps {                sh '/usr/local/bin/pdk validate'            }        }        stage ('Unit Test') {            steps {                sh '/usr/local/bin/pdk test unit'             }        }        stage ('Integration Test') {            steps {                sh './acceptance.sh'             }        }    }
post {        always {            deleteDir()        }    }}

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.