jobs.groovy 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. organizationFolder('GitLab Organization Folder') {
  2. description("https://gitlab.com/wigust")
  3. displayName('wigust')
  4. // "Projects"
  5. organizations {
  6. gitLabSCMNavigator {
  7. projectOwner("wigust")
  8. // credentialsId("i<3GitLab")
  9. serverName("default")
  10. // "Traits" ("Behaviours" in the GUI) that are "declarative-compatible"
  11. traits {
  12. subGroupProjectDiscoveryTrait() // discover projects inside subgroups
  13. gitLabBranchDiscovery {
  14. strategyId(3) // discover all branches
  15. }
  16. // originMergeRequestDiscoveryTrait {
  17. // strategyId(1) // discover MRs and merge them with target branch
  18. // }
  19. gitLabTagDiscovery() // discover tags
  20. }
  21. }
  22. }
  23. // "Traits" ("Behaviours" in the GUI) that are NOT "declarative-compatible"
  24. // For some 'traits, we need to configure this stuff by hand until JobDSL handles it
  25. // https://issues.jenkins.io/browse/JENKINS-45504
  26. configure { node ->
  27. def traits = node / navigators / 'io.jenkins.plugins.gitlabbranchsource.GitLabSCMNavigator' / traits
  28. // traits << 'io.jenkins.plugins.gitlabbranchsource.ForkMergeRequestDiscoveryTrait' {
  29. // strategyId('2')
  30. // trust(class: 'io.jenkins.plugins.gitlabbranchsource.ForkMergeRequestDiscoveryTrait$TrustPermission')
  31. // }
  32. }
  33. // "Project Recognizers"
  34. projectFactories {
  35. workflowMultiBranchProjectFactory {
  36. scriptPath 'Jenkinsfile'
  37. }
  38. }
  39. // "Orphaned Item Strategy"
  40. orphanedItemStrategy {
  41. discardOldItems {
  42. daysToKeep(-1)
  43. numToKeep(-1)
  44. }
  45. }
  46. // "Scan Organization Folder Triggers" : 1 day
  47. // We need to configure this stuff by hand because JobDSL only allow 'periodic(int min)' for now
  48. configure { node ->
  49. node / triggers / 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger' {
  50. spec('H H * * *')
  51. interval(86400000)
  52. }
  53. }
  54. }