Create a gist now

Instantly share code, notes, and snippets.

def organization = 'IT-Puppet'
def github_url = 'https://your-github-enterprise.local'
def page = 1
def linkHeader = 'rel="next"'
def pages = []
while (linkHeader =~ /.*rel="next"/ ) {
repoApi = new URL("${github_url}/api/v3/orgs/${organization}/repos?page=${page}")
linkHeader = repoApi.openConnection().getHeaderField("Link")
println linkHeader
pages << new groovy.json.JsonSlurper().parse(repoApi.newReader())
page++
}
pages.each {
it.each {
def repoName = it.name
job ("${organization}-${repoName}".replaceAll('/','-')){
scm {
git("${github_url}/${organization}/${repoName}")
}
steps {
shell("/usr/local/bin/check_puppet_style.sh -x autoloader_layout -f ./")
}
triggers {
scm('H/30 * * * *')
}
publishers {
warnings(['Puppet-lint'])
mailer('email@example.com', true, true)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment