Initial outline of opencord integration repo
- Vagrantfile to support standardized 'corddev' development environment
- Ansible playbooks to properly bring up devenv
- Gradle build structure
- Gradle plugin to manage docker-based workflow (pull, build, run, tag,
push, etc.)
- Gradle top-level build file to allow pre-fetching and publishing
component docker images. Supported main tasks: fetch, publish
- Example to how to manage 'as-is' upstream components
- Added initial content to README.md
- Added initial content to docs/quickstart.md
- Updated .gitignore
- Placeholder, parametric entry for deploy step
- Placeholder deployment profile config file (config/default.yml)
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 0000000..cbb6652
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+apply plugin: 'groovy'
+
+repositories {
+ // maven { url 'https://repo.gradle.org/gradle/libs' }
+ maven { url 'https://plugins.gradle.org/m2/' }
+ // mavenCentral()
+}
+
+dependencies {
+ compile gradleApi()
+ compile localGroovy()
+ 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/build/rules/DockerFetchRule.groovy b/buildSrc/src/main/groovy/org/opencord/build/rules/DockerFetchRule.groovy
new file mode 100644
index 0000000..01f9176
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/build/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.build.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<image-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/build/rules/DockerPublishRule.groovy b/buildSrc/src/main/groovy/org/opencord/build/rules/DockerPublishRule.groovy
new file mode 100644
index 0000000..75a5990
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/build/rules/DockerPublishRule.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.build.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<image-name>'
+ }
+
+ void apply(String taskName) {
+ if (taskName.startsWith('publish')) {
+ project.task(taskName, type: DockerPushTask) {
+ ext.compName = taskName - 'publish'
+ dependsOn "tag" + compName
+ repositoryName = compName + ':' + project.targetTag
+ registry = project.targetReg
+ }
+ }
+ }
+}
diff --git a/buildSrc/src/main/groovy/org/opencord/build/rules/DockerTagRule.groovy b/buildSrc/src/main/groovy/org/opencord/build/rules/DockerTagRule.groovy
new file mode 100644
index 0000000..114bdfc
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/opencord/build/rules/DockerTagRule.groovy
@@ -0,0 +1,49 @@
+/*
+ * 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.build.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<image-name>'
+ }
+
+ void apply(String taskName) {
+ if (taskName.startsWith('tag')) {
+ project.task(taskName, type: DockerTagTask) {
+ ext.compName = taskName - 'tag'
+ dependsOn "fetch" + compName
+ def spec = project.comps[ext.compName]
+ imageId = spec.name + '@' + spec.digest
+ tag = compName + ':' + project.targetTag
+ }
+ }
+ }
+}