Skip to content

Instantly share code, notes, and snippets.

@afalko
Created June 3, 2017 01:45
Show Gist options
  • Save afalko/71913829904255229baa931f2d8fed02 to your computer and use it in GitHub Desktop.
Save afalko/71913829904255229baa931f2d8fed02 to your computer and use it in GitHub Desktop.
for (GitOrganization gitOrganization : <list of orgs>) {
dslFactory.organizationFolder(gitOrganization.getName()) {
displayName(gitOrganization.getName())
description("This organization is auto-created by blah blah")
triggers {
// Every minute
periodic(1)
}
organizations {
github {
repoOwner(gitOrganization.getOwner())
// TODO: Unhardcode these
apiUri('https://example.com/api/v3')
scanCredentialsId('example-secret')
checkoutCredentialsId('example-secret')
buildOriginBranch(true)
buildOriginBranchWithPR(false)
buildOriginPRMerge(true)
buildOriginPRHead(false)
buildForkPRMerge(true)
buildForkPRHead(false)
excludes(gitOrganization.getExludes().join(" "))
includes(gitOrganization.getIncludes().join(" "))
pattern(gitOrganization.getPattern())
}
}
configure {
Node projectFactories = it / 'projectFactories'
it.remove(projectFactories)
it / 'projectFactories' / "${gitOrganization.getRecognizer().toString()}" {}
}
})
}
# Everything works except that projectFactories get set to the same exact thing as the last item in the for loop
# i.e. if you create two org folders: x and y
# x uses recognizer "r" and y uses recognizer "s"
# If y is last in the for loop, x will have recognizer "s" and y will have recognizer "s"
# If x is last in the for loop, x will have recognizer "r" and y will have recognizer "r"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment