aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/docker/scripts
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-07-28 12:26:54 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-07-28 12:26:54 -0700
commitd04e4407a6a5888b8f6d924e0c9706378c3d285a (patch)
treea1847dab1f8bbf784747166eaf623df958aa9e30 /packaging/docker/scripts
parent14387356f435a416f1f180d0d670d5760888c6b3 (diff)
Add integration scripts from OPEN-O
Change-Id: Ife6951ed9ea8c5b9dcea68e7a095b6bd5180e7d1 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'packaging/docker/scripts')
-rwxr-xr-xpackaging/docker/scripts/build-all-images.sh37
-rwxr-xr-xpackaging/docker/scripts/gen-all-dockerfiles.sh65
-rwxr-xr-xpackaging/docker/scripts/gen-dockerfiles.py119
-rwxr-xr-xpackaging/docker/scripts/gen-dockerfiles.sh230
-rwxr-xr-xpackaging/docker/scripts/get-latest-build.sh19
-rwxr-xr-xpackaging/docker/scripts/get-tomcat-version.sh19
-rwxr-xr-xpackaging/docker/scripts/ls-microservices.py26
-rwxr-xr-xpackaging/docker/scripts/pull-all-images.sh31
-rwxr-xr-xpackaging/docker/scripts/push-all-images.sh50
-rwxr-xr-xpackaging/docker/scripts/verify-dockerfiles.sh29
10 files changed, 625 insertions, 0 deletions
diff --git a/packaging/docker/scripts/build-all-images.sh b/packaging/docker/scripts/build-all-images.sh
new file mode 100755
index 000000000..8137ce71b
--- /dev/null
+++ b/packaging/docker/scripts/build-all-images.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+# $1 org
+
+if [ -z "$1" ]; then
+ ORG="openoint"
+else
+ ORG=$1
+fi
+
+set -exu
+
+VERSION="1.1.0-SNAPSHOT"
+
+# docker root dir
+ROOT=`git rev-parse --show-toplevel`/test/csit/docker
+
+cd $ROOT
+for image in `$ROOT/scripts/ls-microservices.py | sort`; do
+ echo
+ echo $image
+ docker build -t $ORG/$image:$VERSION -t $ORG/$image:latest $image/target
+done
diff --git a/packaging/docker/scripts/gen-all-dockerfiles.sh b/packaging/docker/scripts/gen-all-dockerfiles.sh
new file mode 100755
index 000000000..531eb3041
--- /dev/null
+++ b/packaging/docker/scripts/gen-all-dockerfiles.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+# $1 autorelease build
+
+if [ -z "$1" ]; then
+ BUILD="snapshots"
+else
+ BUILD=$1
+fi
+
+VERSION="1.1.0-SNAPSHOT"
+
+# docker root dir
+ROOT=`git rev-parse --show-toplevel`/test/csit/docker
+
+cd $ROOT
+for dirsrc in `$ROOT/scripts/ls-microservices.py | sort`; do
+ $ROOT/scripts/gen-dockerfiles.sh $dirsrc $BUILD &
+done
+wait
+
+
+mkdir -p $ROOT/target
+cat > $ROOT/target/pom.xml <<EOF
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openo.integration.docker</groupId>
+ <artifactId>docker-root</artifactId>
+ <version>${VERSION}</version>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.19.0</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+ <modules>
+EOF
+for dirsrc in `$ROOT/scripts/ls-microservices.py | sort`; do
+cat >> $ROOT/target/pom.xml <<EOF
+ <module>../${dirsrc}/target</module>
+EOF
+done
+cat >> $ROOT/target/pom.xml <<EOF
+ </modules>
+</project>
+EOF
diff --git a/packaging/docker/scripts/gen-dockerfiles.py b/packaging/docker/scripts/gen-dockerfiles.py
new file mode 100755
index 000000000..498727388
--- /dev/null
+++ b/packaging/docker/scripts/gen-dockerfiles.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+import sys, csv, subprocess, os, shutil, urllib2, argparse
+
+parser = argparse.ArgumentParser(description='Generate docker image definition for a microservice. The results will be placed under the target/ subdirectory.')
+parser.add_argument('microservice', help='filename of microservice as entered in binaries.csv')
+parser.add_argument('--build', default="snapshot", help='a specific build to use ("autorelease-????")')
+
+args = parser.parse_args()
+
+version = "1.1.0-SNAPSHOT"
+
+root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip()
+path = "{}/test/csit/docker".format(root)
+url_template = "https://nexus.open-o.org/service/local/artifact/maven/redirect?r=snapshots&g={0}&a={1}&e={2}&c={3}&v=LATEST"
+
+found = False
+
+with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f:
+ reader = csv.DictReader(f)
+
+ for row in reader:
+ if row["filename"] == args.microservice:
+ found = True
+ print row["filename"]
+
+ if row["classifier"]:
+ file = "{}-{}-{}.{}".format(row["artifactId"], version, row["classifier"], row["extension"])
+ dest = "{}-{}-{}.{}".format(row["filename"], version, row["classifier"], row["extension"])
+ else:
+ file = "{}-{}.{}".format(row["artifactId"], version, row["extension"])
+ dest = "{}-{}.{}".format(row["filename"], version, row["extension"])
+
+ dir = "{}/{}/target".format(path, row["filename"])
+
+ try:
+ shutil.rmtree(dir, True)
+ os.makedirs(dir)
+ except OSError:
+ pass
+
+ # create empty Dockerfile if not exists
+ open( "{}/Dockerfile".format(dir), "a" ).close()
+
+ outfile = open( "{}/50-microservice.txt".format(dir), "w" )
+
+ outfile.write("# 50-microservice.txt - AUTOGENERATED, DO NOT MODIFY MANUALLY\n\n")
+ outfile.write("# Set up microservice\n")
+ if args.build == "snapshot":
+ redir_url = url_template.format(row["groupId"], row["artifactId"], row["extension"], row["classifier"])
+ outfile.write("# {}\n".format(redir_url))
+ response = urllib2.urlopen(redir_url)
+ url = response.geturl()
+ else:
+ url = "https://nexus.open-o.org/content/repositories/{}/{}/{}/{}/{}".format(args.build, row["groupId"].replace(".","/"), row["artifactId"], version, file )
+
+
+ outfile.write("RUN wget -q -O {} \"{}\"".format(dest, url))
+ # outfile.write("ADD \"{}\" {}\n".format(url, dest))
+
+ unzip_opt = ""
+ if row["extension"] == "tar.gz":
+ if row["unzip-dir"]:
+ unzip_opt = " -C {}".format(row["unzip-dir"])
+ outfile.write(" && tar -xf {}{}".format(dest, unzip_opt))
+ elif row["extension"] == "zip":
+ if row["unzip-dir"]:
+ unzip_opt = " -d {}".format(row["unzip-dir"])
+ outfile.write(" && unzip -q -o -B {}{}".format(dest, unzip_opt))
+ outfile.write(" && rm -f {}\n".format(dest))
+
+ outfile.write("# Set permissions\n")
+ outfile.write("RUN find . -type d -exec chmod o-w {} \;\n")
+ outfile.write("RUN find . -name \"*.sh\" -exec chmod +x {} \;\n")
+
+ if row["ports"]:
+ ports = row["ports"].split()
+ for port in ports:
+ outfile.write("EXPOSE {}\n".format(port))
+ outfile.write("RUN echo Open-O {} {} \"{}\" > OPENO_VERSION\n".format(row["filename"], version, url))
+ outfile.write("\n\n")
+
+ outfile.close()
+
+
+ def symlink(flag, template):
+ try:
+ os.remove("{}/{}".format(dir, template))
+ except OSError:
+ pass
+ if flag:
+ os.symlink("../../templates/{}".format(template), "{}/{}".format(dir, template))
+
+ symlink(True, "10-basebuild.txt")
+ symlink(row["python"], "15-python.txt")
+ symlink(row["mysql"], "20-mysql.txt")
+ if row["tomcat"]:
+ # create empty 30-tomcat.txt as marker for gen-dockerfiles.sh
+ open( "{}/30-tomcat.txt".format(dir), "a" ).close()
+ symlink(row["mongodb"], "25-mongodb.txt")
+ symlink(True, "90-entrypoint.txt")
+
+if not found:
+ print "Error: microservice {} not found in binaries.csv.".format(args.microservice)
+ sys.exit(2)
diff --git a/packaging/docker/scripts/gen-dockerfiles.sh b/packaging/docker/scripts/gen-dockerfiles.sh
new file mode 100755
index 000000000..5cd926a98
--- /dev/null
+++ b/packaging/docker/scripts/gen-dockerfiles.sh
@@ -0,0 +1,230 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+# $1 dirsrc
+# $2 autorelease build
+
+set -e
+
+dirsrc=$1
+
+if [ -z "$2" ]; then
+ BUILD="snapshots"
+else
+ BUILD=$2
+fi
+
+VERSION="1.1.0-SNAPSHOT"
+
+# docker root dir
+ROOT=`git rev-parse --show-toplevel`/test/csit/docker
+
+cd $ROOT
+dir=$dirsrc/target
+mkdir -p $dir
+
+if [ "$BUILD" = "snapshots" ]; then
+ $ROOT/scripts/gen-dockerfiles.py $dirsrc
+else
+ $ROOT/scripts/gen-dockerfiles.py $dirsrc --build $BUILD
+fi
+
+# Update build number in workaround files
+for file in `find $dirsrc -name 80-workaround.txt`; do
+ sed -i "s|autorelease-[0-9]\{4\}|$BUILD|" $file
+done
+
+
+cp $ROOT/../../../distribution/LICENSE $dir
+cp -f $dirsrc/*.txt $dir 2>/dev/null || :
+
+if [ -f $dir/20-mysql.txt ]; then
+ cp $ROOT/templates/init-mysql.sh $dir/init-mysql.sh
+else
+ rm -f $dir/init-mysql.sh
+fi
+
+
+# empty 30-tomcat.txt would be created by gen-dockerfiles.py where required
+if [ -f $dir/30-tomcat.txt ]; then
+ TOMCAT_VERSION=`$ROOT/scripts/get-tomcat-version.sh`
+ cat > $dir/30-tomcat.txt <<EOF
+# 30-tomcat.txt - AUTOGENERATED, DO NOT MODIFY MANUALLY
+# Set up tomcat
+RUN wget -q http://mirrors.ocf.berkeley.edu/apache/tomcat/tomcat-8/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz && tar --strip-components=1 -xf apache-tomcat-${TOMCAT_VERSION}.tar.gz && rm -f apache-tomcat-${TOMCAT_VERSION}.tar.gz && rm -rf webapps && mkdir -p webapps/ROOT
+RUN echo 'export CATALINA_OPTS="\$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > /service/bin/setenv.sh
+ENV CATALINA_HOME /service
+
+EOF
+fi
+
+
+
+cat > $dir/docker-entrypoint.sh <<EOF
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+#
+# This file was auto-generated by gen-all-dockerfiles.sh; do not modify manually.
+#
+# $dir/docker-entrypoint.sh
+#
+
+if [ -z "\$SERVICE_IP" ]; then
+ export SERVICE_IP=\`hostname -i\`
+fi
+echo
+echo Environment Variables:
+echo "SERVICE_IP=\$SERVICE_IP"
+
+EOF
+
+if [ $dirsrc != "common-services-msb" ]; then
+ cat >> $dir/docker-entrypoint.sh <<EOF
+if [ -z "\$MSB_ADDR" ]; then
+ echo "Missing required variable MSB_ADDR: Microservices Service Bus address <ip>:<port>"
+ exit 1
+fi
+echo "MSB_ADDR=\$MSB_ADDR"
+echo
+
+# Wait for MSB initialization
+echo Wait for MSB initialization
+for i in {1..20}; do
+ curl -sS -m 1 \$MSB_ADDR > /dev/null && break
+ sleep \$i
+done
+
+EOF
+fi
+
+cat >> $dir/docker-entrypoint.sh <<EOF
+echo
+
+# Configure service based on docker environment variables
+./instance-config.sh
+
+EOF
+if [ -f $dir/20-mysql.txt ]; then
+ cat >> $dir/docker-entrypoint.sh <<EOF
+# Start mysql
+su mysql -c /usr/bin/mysqld_safe &
+
+EOF
+fi
+if [ -f $dir/25-mongodb.txt ]; then
+ cat >> $dir/docker-entrypoint.sh <<EOF
+# Start mongodb
+mongod &
+
+EOF
+fi
+cat >> $dir/docker-entrypoint.sh <<EOF
+# Perform one-time config
+if [ ! -e init.log ]; then
+ # Perform workarounds due to defects in release binary
+ ./instance-workaround.sh
+
+EOF
+if [ -f $dir/20-mysql.txt ]; then
+ cat >> $dir/docker-entrypoint.sh <<EOF
+ # Init mysql; set root password
+ ./init-mysql.sh
+
+EOF
+fi
+cat >> $dir/docker-entrypoint.sh <<EOF
+ # microservice-specific one-time initialization
+ ./instance-init.sh
+
+ date > init.log
+fi
+
+# Start the microservice
+./instance-run.sh
+
+EOF
+
+cat > $dir/Dockerfile <<EOF
+#
+# This file was auto-generated by gen-all-dockerfiles.sh; do not modify manually.
+#
+# $dir/Dockerfile
+#
+
+EOF
+
+cat $dir/*.txt >> $dir/Dockerfile
+
+for file in instance-config.sh instance-init.sh instance-run.sh instance-workaround.sh; do
+ if [ ! -f $dirsrc/$file ]; then
+ cp -n $ROOT/templates/instance-script.sh $dirsrc/$file
+ fi
+done
+
+cp -f $dirsrc/instance-*.sh $dir
+touch $dir/instance-config.sh
+touch $dir/instance-init.sh
+touch $dir/instance-run.sh
+touch $dir/instance-workaround.sh
+chmod +x $dir/*.sh
+
+
+cat > $dir/pom.xml <<EOF
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openo.integration.docker</groupId>
+ <artifactId>${dirsrc}</artifactId>
+ <version>${VERSION}</version>
+ <packaging>docker</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.19.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <images>
+ <image>
+ <name>openoint/${dirsrc}</name>
+ <build>
+ <dockerFileDir>.</dockerFileDir>
+ <tags>
+ <tag>latest</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+EOF
diff --git a/packaging/docker/scripts/get-latest-build.sh b/packaging/docker/scripts/get-latest-build.sh
new file mode 100755
index 000000000..388a6d33c
--- /dev/null
+++ b/packaging/docker/scripts/get-latest-build.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+# get latest autorelease build
+curl -sS https://nexus.open-o.org/content/repositories/ | grep autorelease | sed 's|<[^>]*>||g' | sed -r 's|\s+||g' | cut -d/ -f 1 | sort | tail -1
diff --git a/packaging/docker/scripts/get-tomcat-version.sh b/packaging/docker/scripts/get-tomcat-version.sh
new file mode 100755
index 000000000..316a0ec94
--- /dev/null
+++ b/packaging/docker/scripts/get-tomcat-version.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+# get latest 8.5 tomcat version
+curl -sS http://mirrors.ocf.berkeley.edu/apache/tomcat/tomcat-8/ | grep v8.5 | sed 's|<[^>]*>||g' | sed -r 's|\s+||g' | sed 's|/.*||g' | sed 's|v||g' | tail -1
diff --git a/packaging/docker/scripts/ls-microservices.py b/packaging/docker/scripts/ls-microservices.py
new file mode 100755
index 000000000..7a7433be3
--- /dev/null
+++ b/packaging/docker/scripts/ls-microservices.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+import sys, csv, subprocess, os, urllib2
+
+root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip()
+
+with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f:
+ reader = csv.DictReader(f)
+
+ for row in reader:
+ print row["filename"]
diff --git a/packaging/docker/scripts/pull-all-images.sh b/packaging/docker/scripts/pull-all-images.sh
new file mode 100755
index 000000000..aee3bb2e3
--- /dev/null
+++ b/packaging/docker/scripts/pull-all-images.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+set -exu
+
+VERSION="1.1.0-SNAPSHOT"
+
+# docker root dir
+ROOT=`git rev-parse --show-toplevel`/test/csit/docker
+
+cd $ROOT
+for image in `$ROOT/scripts/ls-microservices.py | sort`; do
+ echo
+ echo $image
+ docker pull openoint/$image:$VERSION
+ docker pull openoint/$image:latest
+done
diff --git a/packaging/docker/scripts/push-all-images.sh b/packaging/docker/scripts/push-all-images.sh
new file mode 100755
index 000000000..00684c61d
--- /dev/null
+++ b/packaging/docker/scripts/push-all-images.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+# $1 org
+
+if [ -z "$1" ]; then
+ ORG="openoint"
+else
+ ORG=$1
+fi
+
+set -ex
+
+VERSION="1.1.0-SNAPSHOT"
+
+# docker root dir
+ROOT=`git rev-parse --show-toplevel`/test/csit/docker
+
+if [ -z "$MVN" ]; then
+ export MVN=`which mvn`
+fi
+if [ -z "$MVN" ] && [ -x /w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn ]; then
+ export MVN="/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn"
+fi
+
+cd $ROOT
+for image in `$ROOT/scripts/ls-microservices.py | sort`; do
+ echo
+ echo $image
+
+ if [ ! -z "$MVN" ]; then
+ $MVN -f $image/target docker:push
+ else
+ docker push $ORG/$image:$VERSION
+ docker push $ORG/$image:latest
+ fi
+done
diff --git a/packaging/docker/scripts/verify-dockerfiles.sh b/packaging/docker/scripts/verify-dockerfiles.sh
new file mode 100755
index 000000000..e2acbdc90
--- /dev/null
+++ b/packaging/docker/scripts/verify-dockerfiles.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+
+# docker root dir
+ROOT=`git rev-parse --show-toplevel`/test/csit/docker
+
+MICROSERVICES=`$ROOT/scripts/ls-microservices.py`
+
+EXIT_CODE=0
+for dir in `find $ROOT -maxdepth 1 -mindepth 1 -type d ! -name scripts ! -name templates -printf '%f\n'`; do
+ if ! grep -q $dir <<<$MICROSERVICES; then
+ echo ERROR: $dir not found in binaries.csv
+ EXIT_CODE=1
+ fi
+done
+exit $EXIT_CODE