Created
August 7, 2019 21:51
-
-
Save sboardwell/16a2f66a5a138e1389dc17d2e9da5d17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
options { ... } | |
parameters { ... } | |
agent { ... } | |
stages { | |
stage('Test') { | |
when { | |
changeRequest() | |
} | |
steps { | |
sh 'gradle clean test' | |
} | |
post { | |
always { | |
archiveArtifacts allowEmptyArchive: true, artifacts: '**/build/reports/tests/**/*.*' | |
junit allowEmptyResults: true, testResults: '**/build/test-results/test/*.xml' | |
} | |
} | |
} | |
stage('Run DSL') { | |
when { | |
anyOf { | |
branch 'master' | |
} | |
} | |
steps { | |
script { | |
try { | |
jobDsl( | |
failOnMissingPlugin: true, | |
removedConfigFilesAction: 'DELETE', | |
removedJobAction: 'DELETE', | |
removedViewAction: 'DELETE', | |
targets: 'jobs/**/*.groovy', | |
unstableOnDeprecation: true | |
) | |
} catch (def e) { | |
timeout(50) { | |
echo "Looks like we might have to approve some DSL scripts. Please check at ${JENKINS_URL}/scriptApproval" | |
input "DSL Scripts approved? Then 'continue', otherwise 'abort'." | |
jobDsl( | |
failOnMissingPlugin: true, | |
removedConfigFilesAction: 'DELETE', | |
removedJobAction: 'DELETE', | |
removedViewAction: 'DELETE', | |
targets: 'jobs/**/*.groovy', | |
unstableOnDeprecation: true | |
) | |
} | |
} | |
} | |
} | |
} | |
} | |
post { | |
cleanup { | |
cleanWs() | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment