Guest User

Untitled

a guest
Jan 31st, 2021
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. pipelineJob('seedJob') {
  2. description('SeedJob for generate jobs by jobdsl plugin')
  3.  
  4. logRotator {
  5. numToKeep(10)
  6. artifactNumToKeep(10)
  7. }
  8.  
  9. triggers {
  10. gitlab {
  11. secretToken("s3cr3tt0k3n_h3r3")
  12. triggerOnNoteRequest(false)
  13. }
  14. }
  15.  
  16. definition {
  17. cpsScm {
  18. scm {
  19. git {
  20. extensions {
  21. wipeOutWorkspace()
  22. }
  23. remote {
  24. branch('origin/master')
  25. url("$GIT_REPOSITORY_URL/jenkins_pipelines.git")
  26. credentials('creds_on_gitlab')
  27. }
  28. }
  29. }
  30. scriptPath('pipelines/common/seedJob.Jenkinsfile')
  31. }
  32. }
  33. }
  34.  
  35. ///////////////////////////////////////////////////////////////////////////////
  36.  
  37. pipeline {
  38. agent any
  39.  
  40. stages {
  41. stage ('Download git repo jenkins_pipeline') {
  42. steps {
  43. checkout([$class: 'GitSCM',
  44. branches: [[name: '*/master']],
  45. userRemoteConfigs: [[credentialsId: 'creds_on_gitlab',
  46. url: "$GIT_REPOSITORY_URL/jenkins_pipelines.git"]]
  47. ])
  48.  
  49. script {
  50. switch(JENKINS_INSTANCE) {
  51. case ~/.*prod.*/:
  52. SEED_JOBS_TARGETS = [
  53. "jobs/common/**/*.groovy",
  54. "jobs/crypto-service/**/*.groovy",
  55. "jobs/domain/prod/*.groovy"].join('\n')
  56. break
  57. default:
  58. throw new RuntimeException("please, define 'JENKINS_INSTANCE' variable")
  59. }
  60. }
  61.  
  62. jobDsl targets: "${SEED_JOBS_TARGETS}",
  63. removedJobAction: 'DELETE'
  64. }
  65. }
  66. stage('PROD Display list management') {
  67. when {
  68. expression { JENKINS_INSTANCE.endsWith('prod') }
  69. }
  70. steps {
  71. jobDsl targets: ['views/listview_prod.groovy'].join('\n'),
  72. ignoreMissingFiles: true
  73. }
  74. }
  75. }
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment