projects = [ [name: "serviceA", cron: "@daily"], [name: "serviceB", cron: "@hourly"], [name: "serviceC", cron: "@daily"], ] for(project in projects) { folder("${project.name}") multibranchPipelineJob("${project.name}/build") { triggers { cron("${project.cron}") } orphanedItemStrategy { discardOldItems { numToKeep(5) } } branchSources { github { scanCredentialsId('github-ci-user-credentials') repoOwner('devtail') repository("${project.name}") buildOriginBranch(true) buildOriginPRMerge(true) buildOriginBranchWithPR(false) id("${project.name}-branch-id") } } factory { workflowBranchProjectFactory { scriptPath('jenkinsfile/build.groovy') } } } }