Created
May 7, 2020 05:23
-
-
Save ekowcharles/633f0d1f3023244efff74c6142814224 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def project = 'ekowcharles/jenkins-jobs-repo' | |
def branchApi = new URL("https://api.github.com/repos/${project}/branches") | |
def branches = new groovy.json.JsonSlurper().parse(branchApi.newReader()) | |
branches.each { | |
def branchName = it.name | |
def jobName = "${project}-${branchName}".replaceAll('/','-') | |
pipelineJob(jobName) { | |
triggers { | |
scm('* * * * *') | |
} | |
definition { | |
cpsScm { | |
scm { | |
git("git://github.com/${project}.git", branchName) | |
} | |
scriptPath("Jenkinsfile") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment