CORD-421 added standard label schema to the image builds
Change-Id: Ie2110ac722bdca9f2b07ae21fe9e56a0a3066585
diff --git a/automation/Dockerfile b/automation/Dockerfile
index 80b4e73..24ade99 100644
--- a/automation/Dockerfile
+++ b/automation/Dockerfile
@@ -29,4 +29,10 @@
RUN mkdir -p /root/.ssh
COPY ssh-config /root/.ssh/config
+LABEL org.label-schema.name="automation" \
+ org.label-schema.description="Provides automation of the compute node deployment and provisioning process" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT ["/go/bin/cord-maas-automation"]
diff --git a/bootstrap/Dockerfile b/bootstrap/Dockerfile
index 01705a4..085bb25 100644
--- a/bootstrap/Dockerfile
+++ b/bootstrap/Dockerfile
@@ -23,4 +23,10 @@
ADD bootstrap.py /bootstrap.py
+LABEL org.label-schema.name="bootstrap" \
+ org.label-schema.description="Provides bootstrap configuration of MAAS for the CORD deployment" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT [ "/bootstrap.py" ]
diff --git a/build.gradle b/build.gradle
index aa37a17..6533aa2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -65,8 +65,33 @@
// Switch Configuration Image
+def getBuildTimestamp() {
+ def cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"))
+ def date = cal.getTime()
+ def formattedDate = date.format("yyyy-MM-dd'T'HH:mm:ss.ss'Z'")
+ return formattedDate
+}
+
+def getCommitHash = { ->
+ def hashStdOut = new ByteArrayOutputStream()
+ exec {
+ commandLine "git", "rev-parse", "HEAD"
+ standardOutput = hashStdOut
+ }
+ return hashStdOut.toString().trim()
+}
+
+def getBranchName = { ->
+ def branchStdOut = new ByteArrayOutputStream()
+ exec {
+ commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
+ standardOutput = branchStdOut
+ }
+ return branchStdOut.toString().trim()
+}
+
task buildSwitchqImage(type: Exec) {
- commandLine "docker", 'build', '-t', 'cord-maas-switchq', './switchq'
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-maas-switchq', './switchq'
}
task tagSwitchqImage(type: Exec) {
@@ -82,7 +107,7 @@
// Bootstrap Image
task buildBootstrapImage(type: Exec) {
- commandLine "docker", 'build', '-t', 'cord-maas-bootstrap', './bootstrap'
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-maas-bootstrap', './bootstrap'
}
task tagBootstrapImage(type: Exec) {
@@ -98,7 +123,7 @@
// IP Allocator Image
task buildAllocationImage(type: Exec) {
- commandLine "docker", 'build', '-t', 'cord-ip-allocator', './ip-allocator'
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-ip-allocator', './ip-allocator'
}
task tagAllocationImage(type: Exec) {
@@ -114,7 +139,7 @@
// Provisioner Image
task buildProvisionerImage(type: Exec) {
- commandLine "docker", 'build', '-t', 'cord-provisioner', './provisioner'
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-provisioner', './provisioner'
}
task tagProvisionerImage(type: Exec) {
@@ -130,7 +155,7 @@
// Config Generator Image
task buildConfigGeneratorImage(type: Exec) {
- commandLine "docker", 'build', '-t', 'config-generator', './config-generator'
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'config-generator', './config-generator'
}
task tagConfigGeneratorImage(type: Exec) {
@@ -146,7 +171,7 @@
// Automation Image
task buildAutomationImage(type: Exec) {
- commandLine "docker", 'build', '-t', "cord-maas-automation", "-f", "./automation/Dockerfile", "./automation"
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', "cord-maas-automation", "-f", "./automation/Dockerfile", "./automation"
}
task tagAutomationImage(type: Exec) {
@@ -162,7 +187,7 @@
// DHCP Harvester Images
task buildHarvesterImage(type: Exec) {
- commandLine "docker", 'build', '-t', "cord-dhcp-harvester", "./harvester"
+ commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', "cord-dhcp-harvester", "./harvester"
}
task tagHarvesterImage(type: Exec) {
diff --git a/config-generator/Dockerfile b/config-generator/Dockerfile
index 14696e1..d60f34f 100644
--- a/config-generator/Dockerfile
+++ b/config-generator/Dockerfile
@@ -38,4 +38,10 @@
EXPOSE 1337
+LABEL org.label-schema.name="generator" \
+ org.label-schema.description="Provides generation of the fabric configuration" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT ["/go/bin/config-generator"]
diff --git a/harvester/Dockerfile b/harvester/Dockerfile
index d29598a..18bac9d 100644
--- a/harvester/Dockerfile
+++ b/harvester/Dockerfile
@@ -17,4 +17,11 @@
RUN apk update && apk add bind
ADD dhcpharvester.py /dhcpharvester.py
+
+LABEL org.label-schema.name="harvester" \
+ org.label-schema.description="Provides DHCP havesting and insertion into DNS" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT [ "python", "/dhcpharvester.py" ]
diff --git a/ip-allocator/Dockerfile b/ip-allocator/Dockerfile
index c547f85..55f43eb 100644
--- a/ip-allocator/Dockerfile
+++ b/ip-allocator/Dockerfile
@@ -27,4 +27,10 @@
RUN go install gerrit.opencord.org/maas/cord-ip-allocator
+LABEL org.label-schema.name="allocator" \
+ org.label-schema.description="Provides IP address allocation for fabric interfaces" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT ["/go/bin/cord-ip-allocator"]
diff --git a/provisioner/Dockerfile b/provisioner/Dockerfile
index 6d75afb..327a813 100644
--- a/provisioner/Dockerfile
+++ b/provisioner/Dockerfile
@@ -58,4 +58,10 @@
WORKDIR $GOPATH
RUN go install gerrit.opencord.org/maas/cord-provisioner
+LABEL org.label-schema.name="provisioner" \
+ org.label-schema.description="Provides provisioning of compute and switch nodes for CORD" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT ["/go/bin/cord-provisioner"]
diff --git a/switchq/Dockerfile b/switchq/Dockerfile
index b35438d..e8d1602 100644
--- a/switchq/Dockerfile
+++ b/switchq/Dockerfile
@@ -61,4 +61,10 @@
WORKDIR $GOPATH
RUN go install gerrit.opencord.com/maas/switchq
+LABEL org.label-schema.name="switchq" \
+ org.label-schema.description="Provides fabric switch discovery and provisioning" \
+ org.label-schema.vcs-url="https://gerrit.opencord.org/maas" \
+ org.label-schema.vendor="Open Networking Labratory" \
+ org.label-schema.schema-version="1.0"
+
ENTRYPOINT ["/go/bin/switchq"]