|
@@ -1,8 +1,6 @@
|
|
|
-
|
|
|
|
|
-def resolver = build.buildVariableResolver
|
|
|
|
|
-def server = resolver.resolve("GOGS_SERVER") + "/api/v1"
|
|
|
|
|
-def apikey = resolver.resolve("GOGS_API_KEY")
|
|
|
|
|
-def root = "${server}/api/v1"
|
|
|
|
|
|
|
+def server = GOGS_SERVER
|
|
|
|
|
+def apikey = GOGS_API_KEY
|
|
|
|
|
+def api = "${server}/api/v1"
|
|
|
|
|
|
|
|
def restExists(url) {
|
|
def restExists(url) {
|
|
|
def u = new URL(url)
|
|
def u = new URL(url)
|
|
@@ -16,19 +14,16 @@ def restExists(url) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
def restJSONGet(url) {
|
|
def restJSONGet(url) {
|
|
|
- def u = new URL("${root}/user/repos?token=${apikey})
|
|
|
|
|
|
|
+ def u = new URL(url)
|
|
|
return new groovy.json.JsonSlurper().parse(u.newReader())
|
|
return new groovy.json.JsonSlurper().parse(u.newReader())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-def projects = restJSONGet("${root}/user/repos?token=${apikey})
|
|
|
|
|
|
|
+def projects = restJSONGet("${api}/user/repos?token=${apikey}")
|
|
|
|
|
|
|
|
projects.each {
|
|
projects.each {
|
|
|
def project = it.full_name
|
|
def project = it.full_name
|
|
|
- def branches = restJSONGet("${root}/repos/${project}/branches")
|
|
|
|
|
- branches.each {
|
|
|
|
|
- def branchName = it.name
|
|
|
|
|
- def jenkinsFile = restExists("${root}/repos/${project}/raw/${branchName}/Jenkinsfile?token=$apikey}")
|
|
|
|
|
- def jobName = "${project}".replaceAll('/','-')
|
|
|
|
|
- println("${project}/${branchName} - ${jobName} / hasFile ${jenkinsFile}"
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ def branchName = "docker"
|
|
|
|
|
+ def jenkinsFile = restExists("${api}/repos/${project}/raw/${branchName}/Jenkinsfile?token=${apikey}")
|
|
|
|
|
+ def jobName = "${project}".replaceAll('/','-')
|
|
|
|
|
+ println("${project}/${branchName} - ${jobName} / hasFile ${jenkinsFile}")
|
|
|
}
|
|
}
|