updated the repo to be in sync with the automation on the cord uber repo
Change-Id: Id8619f662719d73a2ca80cf0cca7f1665fbd267a
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index e73afbe..cbb6652 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -25,7 +25,7 @@
dependencies {
compile gradleApi()
compile localGroovy()
- //compile 'de.gesellix:gradle-docker-plugin:2016-05-05T13-15-11'
+ compile 'de.gesellix:gradle-docker-plugin:2016-05-05T13-15-11'
compile 'org.yaml:snakeyaml:1.10'
//compile 'gradle.plugin.com.tmiyamon:gradle-config:0.2.1'
}
diff --git a/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerFetchRule.groovy b/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerFetchRule.groovy
new file mode 100644
index 0000000..a9bb91b
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerFetchRule.groovy
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencord.gradle.rules
+
+import org.gradle.api.Rule
+import de.gesellix.gradle.docker.tasks.DockerPullTask
+
+
+/**
+ * Gradle Rule class to fetch a docker image
+ */
+class DockerFetchRule implements Rule {
+
+ def project
+
+ DockerFetchRule(project) {
+ this.project = project
+ }
+
+ String getDescription() {
+ 'Rule Usage: fetch<component-name>'
+ }
+
+ void apply(String taskName) {
+ if (taskName.startsWith('fetch')) {
+ project.task(taskName, type: DockerPullTask) {
+ ext.compName = taskName - 'fetch'
+ def spec = project.comps[ext.compName]
+ imageName = spec.name + '@' + spec.digest
+ }
+ }
+ }
+}
diff --git a/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerPublishRule.groovy b/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerPublishRule.groovy
new file mode 100644
index 0000000..a1d8164
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerPublishRule.groovy
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencord.gradle.rules
+
+import org.gradle.api.Rule
+import de.gesellix.gradle.docker.tasks.DockerPushTask
+
+
+/**
+ * Gradle Rule class to publish (push) a docker image to a private repo
+ */
+class DockerPublishRule implements Rule {
+
+ def project
+
+ DockerPublishRule(project) {
+ this.project = project
+ }
+
+ String getDescription() {
+ 'Rule Usage: publish<component-name>'
+ }
+
+ void apply(String taskName) {
+ if (taskName.startsWith('publish')) {
+ project.task(taskName, type: DockerPushTask) {
+ ext.compName = taskName - 'publish'
+ println "Publish rule: $taskName + $compName"
+ def tagTask = "tag$compName"
+ println "Tagtask: $tagTask"
+ dependsOn tagTask
+ def spec = project.comps[ext.compName]
+ repositoryName = spec.name + ':' + project.targetTag
+ registry = project.targetReg
+ }
+ }
+ }
+}
diff --git a/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerTagRule.groovy b/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerTagRule.groovy
new file mode 100644
index 0000000..474e16d
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/gradle/rules/DockerTagRule.groovy
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencord.gradle.rules
+
+import org.gradle.api.Rule
+import de.gesellix.gradle.docker.tasks.DockerTagTask
+
+
+/**
+ * Gradle Rule class to tag a docker image
+ */
+class DockerTagRule implements Rule {
+
+ def project
+
+ DockerTagRule(project) {
+ this.project = project
+ }
+
+ String getDescription() {
+ 'Rule Usage: tag<component-name>'
+ }
+
+ void apply(String taskName) {
+ if (taskName.startsWith('tag') && !taskName.equals('tag')) {
+ project.task(taskName, type: DockerTagTask) {
+ ext.compName = taskName - 'tag'
+ def spec = project.comps[compName]
+ imageId = spec.name + '@' + spec.digest
+ tag = compName + ':' + project.targetTag
+ }
+ }
+ }
+}
diff --git a/buildSrc/src/main/groovy/org/opencord/gradle/rules/GitSubmoduleUpdateRule.groovy b/buildSrc/src/main/groovy/org/opencord/gradle/rules/GitSubmoduleUpdateRule.groovy
new file mode 100644
index 0000000..3b46424
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/gradle/rules/GitSubmoduleUpdateRule.groovy
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencord.gradle.rules
+
+import org.gradle.api.Rule
+import org.gradle.api.tasks.Exec
+
+
+/**
+ * Gradle Rule class to fetch a docker image
+ */
+class GitSubmoduleUpdateRule implements Rule {
+
+ def project
+
+ GitSubmoduleUpdateRule(project) {
+ this.project = project
+ }
+
+ String getDescription() {
+ 'Rule Usage: gitupdate<component-name>'
+ }
+
+ void apply(String taskName) {
+ if (taskName.startsWith('gitupdate')) {
+ project.task(taskName, type: Exec) {
+ ext.compName = taskName - 'gitupdate'
+ def spec = project.comps[ext.compName]
+ workingDir = '.'
+ commandLine '/usr/bin/git', 'submodule', 'update', '--init', '--recursive', spec.componentDir
+ }
+ }
+ }
+}