Repository: bigtop Updated Branches: refs/heads/master db414adc3 -> 81024ea74
BIGTOP-2081: Implement a nexus docker container for CI Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/81024ea7 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/81024ea7 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/81024ea7 Branch: refs/heads/master Commit: 81024ea7440d5e0acdbc7102ea8644644d99c27a Parents: db414ad Author: Olaf Flebbe <[email protected]> Authored: Sat Dec 5 18:46:53 2015 +0100 Committer: Olaf Flebbe <[email protected]> Committed: Mon Dec 7 12:58:48 2015 +0100 ---------------------------------------------------------------------- build.gradle | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/81024ea7/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 2a48056..77772e1 100644 --- a/build.gradle +++ b/build.gradle @@ -310,6 +310,54 @@ def artifactToInstall = { } } +def generate_nexus_tasks = { name, url, snapshot -> + task "configure-nexus-${name}"(type: Exec) { + def req = [ data : [ id: name, name: name, repoType: "proxy", repoPolicy : snapshot, browseable: true, "indexable": true, "notFoundCacheTTL": 1440, + "artifactMaxAge": 1440, "metadataMaxAge": 1440, "itemMaxAge": 1440, "provider": "maven2", + "providerRole": "org.sonatype.nexus.proxy.repository.Repository", "downloadRemoteIndexes": true, + "autoBlockActive": true, "fileTypeValidation": true, "exposed": true, "checksumPolicy": "WARN", + "remoteStorage": ["remoteStorageUrl": url, "authentication": null, + "connectionSettings": null]]] + def root = new groovy.json.JsonBuilder(req) + def p = root.toString() + File.createTempFile("temp",".tmp").with { + deleteOnExit() + + write root.toString() + + workingDir '.' + commandLine "curl", "-o", "/dev/null", "-X", "POST", "-d", "@$absolutePath", + "--header", "Content-Type: application/json", "-u", "admin:admin123", "http://localhost:8081/service/local/repositories" + } + } +} + +def repos = [ [ "name": "conjars", "url" : "http://conjars.org", 'snapshot':'RELEASE'], + [ "name": "repository.jboss.org", "url": "http://repository.jboss.org/nexus/content/groups/public/", 'snapshot': 'RELEASE'], + [ "name": "apache.snapshots.https", "url": "https://repository.apache.org/content/repositories/snapshots", "snapshot": 'SNAPSHOT'], + [ "name": "apache.snapshots", "url": "https://repository.apache.org/content/repositories/snapshots", "snapshot": 'SNAPSHOT'], + [ "name": "maven2-repository.atlassian", "url": "https://maven.atlassian.com/repository/public", "snapshot": 'RELASE']] + +repos.each { r-> + generate_nexus_tasks( r.name, r.url, r.snapshot) +} + +task "configure-nexus"(dependsOn: tasks.findAll { alltask -> alltask.name.startsWith("configure-nexus-")}*.name, + description: "configure all repos") << { + def m2Dir = System.getProperty("user.home") + "/.m2" + mkdir(m2Dir) + def writer = new File(m2Dir + "/settings.xml") + def writeMirrorLine = { name -> + writer.append("<mirror><name>$name</name><url>http://localhost:8081/content/repositories/$name/</url><mirrorOf>$name</mirrorOf></mirror>") + } + writer.text = "<settings><mirrors>" + writeMirrorLine( "central") + repos.each{ r-> + writeMirrorLine( r.name) + } + writer.append("</mirrors></settings>") +} + task "gen-gradle-home"(type:Exec, description: 'Pre-load gradle home as cache for bigtop/slaves images', group: DOCKERBUILD_GROUP) {
