Skip to content

Instantly share code, notes, and snippets.

@markaltmann
Created March 28, 2020 19:14
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 markaltmann/094741dc2566875a572326d9cf436432 to your computer and use it in GitHub Desktop.
Save markaltmann/094741dc2566875a572326d9cf436432 to your computer and use it in GitHub Desktop.
Jenkinsfile for Asciidoc
#!/usr/bin/env groovy
// Good example for asciidoc-pdf maven:
// https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-pdf-example/pom.xml
pipeline {
options {
buildDiscarder logRotator(
daysToKeepStr: '10',
numToKeepStr: env.BRANCH_NAME == 'master' ? '20' : '30' ,
artifactDaysToKeepStr: '10',
artifactNumToKeepStr: '10'
)
timestamps()
timeout(time: 1, unit: 'HOURS')
ansiColor("xterm")
disableConcurrentBuilds()
}
agent any()
stages {
stage ('Build - AsciiDoc Document') {
steps {
script {
docker.image('maven:3.6-jdk-12').inside('-v /root/.m2:/root/.m2') {
sh('mvn -B generate-resources') // AsciiDoc Target PDF
}
}
archiveArtifacts 'pdf/asciidoc.pdf' // Put the artefact to the build artefacts.
}
}
}
post {
always {
echo 'One way or another, I have finished'
}
success {
echo 'I succeeeded!'
}
unstable {
echo 'I am unstable :/'
}
failure {
echo 'Failure: Check Error Log'
}
cleanup {
cleanWs() // Delete the whole Workspace
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment