Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. pipeline {
  2. options { ... }
  3.  
  4. parameters { ... }
  5.  
  6. agent { ... }
  7.  
  8. stages {
  9. stage('Test') {
  10. when {
  11. changeRequest()
  12. }
  13. steps {
  14. sh 'gradle clean test'
  15. }
  16. post {
  17. always {
  18. archiveArtifacts allowEmptyArchive: true, artifacts: '**/build/reports/tests/**/*.*'
  19. junit allowEmptyResults: true, testResults: '**/build/test-results/test/*.xml'
  20. }
  21. }
  22. }
  23. stage('Run DSL') {
  24. when {
  25. anyOf {
  26. branch 'master'
  27. }
  28. }
  29. steps {
  30. script {
  31. try {
  32. jobDsl(
  33. failOnMissingPlugin: true,
  34. removedConfigFilesAction: 'DELETE',
  35. removedJobAction: 'DELETE',
  36. removedViewAction: 'DELETE',
  37. targets: 'jobs/**/*.groovy',
  38. unstableOnDeprecation: true
  39. )
  40. } catch (def e) {
  41. timeout(50) {
  42. echo "Looks like we might have to approve some DSL scripts. Please check at ${JENKINS_URL}/scriptApproval"
  43. input "DSL Scripts approved? Then 'continue', otherwise 'abort'."
  44. jobDsl(
  45. failOnMissingPlugin: true,
  46. removedConfigFilesAction: 'DELETE',
  47. removedJobAction: 'DELETE',
  48. removedViewAction: 'DELETE',
  49. targets: 'jobs/**/*.groovy',
  50. unstableOnDeprecation: true
  51. )
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. post {
  59. cleanup {
  60. cleanWs()
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement