pipeline {
agent none
stages {
stage('Build') {
agent {
docker {
image 'jenkins-build-agent:latest'
}
}
steps {
echo 'Building..'
sh './build.sh'
archiveArtifacts artifacts: 'build/hello*', fingerprint: true
}
}
stage('Tidy') {
agent { docker 'jenkins-build-agent:latest' }
steps {
echo 'Tidy..'
sh 'make tidy || true'
junit 'build/*.xml'
}
}
stage('Test') {
agent { docker 'jenkins-build-agent:latest' }
steps {
echo 'Testing..'
sh 'make test || true'
junit 'build/*.xml'
}
}
stage('Deploy') {
agent { docker 'jenkins-build-agent:latest' }
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo 'Deploying....'
sh 'make publish'
}
}
}
}