building maven repo containing all onos apps
diff --git a/build.gradle b/build.gradle
index 9d5723a..a757d72 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,15 +39,15 @@
appVersion = null
+ // Upstream registry to simplify filling out the comps table below
+ upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io'
+
// Target registry to be used to publish docker images needed for deployment
targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
// The tag used to tag the docker images push to the target registry
targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
- // The tag used to tag the docker images push to the target registry
- targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
-
comps = [
'aaa' : [
'type': 'gitmodule',
@@ -90,41 +90,52 @@
'branch' : 'master',
'tag' : appVersion,
'componentDir': './apps/config'
- ],
- 'nginx': [
- 'type': 'image',
- 'upstream': upstreamReg,
- 'name': 'nginx',
- 'digest': 'sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
]
]
}
-// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
task fetchGitSubmodules {
comps.each { name, spec -> if (spec.type == 'gitmodule') { dependsOn "gitupdate" + name } }
}
+task buildOnosApps (type: Exec) {
+ workingDir './apps'
+ commandLine 'mvn', 'clean', 'install'
+}
+
+task copyLocalRepo (dependsOn: buildOnosApps, type: Exec) {
+ workingDir './'
+ commandLine 'cp', '-R', System.env.HOME + '/.m2/repository', 'repository'
+}
+
+task buildRepoImage (dependsOn: copyLocalRepo, type: Exec) {
+ commandLine 'docker', 'build', '-t', 'cordproject/mavenrepo', '.'
+}
+
+task tagMavenRepoImage (type: Exec) {
+ commandLine 'docker', 'tag', 'cordproject/mavenrepo', "$targetReg/mavenrepo:$targetTag"
+}
+
+task publishMavenRepoImage (type: Exec) {
+ dependsOn tagMavenRepoImage
+ commandLine 'docker', 'push', "$targetReg/mavenrepo:$targetTag"
+}
+
+// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
+
task fetch {
dependsOn fetchGitSubmodules
}
-// To be used to generate all needed binaries that need to be present on the target
-// as docker images in the local docker runner.
-task buildImages (dependsOn: fetch, type: Exec){
- workingDir './apps'
- commandLine 'mvn', 'clean', 'install'
-
- workingDir './'
-
- commandLine 'cp', '-R', '~/.m2/repository' 'repository/'
- commandLine 'docker', 'build', '-t', 'cordproject/mavenrepo', '.'
+task buildImages (dependsOn: fetch) {
+ dependsOn buildOnosApps
+ dependsOn copyLocalRepo
+ dependsOn buildRepoImage
}
-// Publish image(s) built during the build step into targetReg registry using the targetTag
-// tag. See maas subproject for examples on how to do this.
-task publish (dependsOn: buildImages, type: Exec) {
+task publish {
+ dependsOn publishMavenRepoImage
}
tasks.addRule(new GitSubmoduleUpdateRule(project))