diff options
30 files changed, 1798 insertions, 0 deletions
diff --git a/autorelease/scripts/autorelease-test.sh b/autorelease/scripts/autorelease-test.sh new file mode 100755 index 000000000..b5d584e50 --- /dev/null +++ b/autorelease/scripts/autorelease-test.sh @@ -0,0 +1,35 @@ +#!/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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease +GERRIT_BRANCH='master' + +cd $ROOT +git checkout build + +BUILD_DIR=$ROOT/build +cd $BUILD_DIR + +$ROOT/scripts/clone-all.sh +$ROOT/scripts/generate-pom.sh +$ROOT/scripts/fix-relativepaths.sh +$ROOT/scripts/set-version.sh + +TMPDIR=`mktemp -d` +mvn -q clean deploy -DdisableJavaSdkAutoGeneration -DaltDeploymentRepository=staging::default::file:$TMPDIR -DskipTests=true -Dcheckstyle.skip=true +echo "TMPDIR=$TMPDIR" diff --git a/autorelease/scripts/clone-all.sh b/autorelease/scripts/clone-all.sh new file mode 100755 index 000000000..936d8ea08 --- /dev/null +++ b/autorelease/scripts/clone-all.sh @@ -0,0 +1,39 @@ +#!/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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease +GERRIT_BRANCH='master' + +BUILD_DIR=$ROOT/build +cd $BUILD_DIR + +$ROOT/scripts/get-all-repos.sh | while read p; do + cd $BUILD_DIR + if [ -e $BUILD_DIR/$p ]; then + cd $BUILD_DIR/$p + git checkout $GERRIT_BRANCH + git reset --hard origin + git clean -f + git pull + else + #TODO: replace with https once repo is open to public + git clone -b $GERRIT_BRANCH ssh://gerrit.open-o.org:29418/$p + fi +done + +rm -rf $BUILD_DIR/integration/autorelease/build diff --git a/autorelease/scripts/diff-all.sh b/autorelease/scripts/diff-all.sh new file mode 100755 index 000000000..5bb502f25 --- /dev/null +++ b/autorelease/scripts/diff-all.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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease +GERRIT_BRANCH='sun' + +BUILD_DIR=$ROOT/build + +mkdir -p $BUILD_DIR +cd $BUILD_DIR + +$ROOT/scripts/get-all-repos.sh | while read p; do + cd $BUILD_DIR/$p + echo $p + git diff | cat +done diff --git a/autorelease/scripts/fix-names.sh b/autorelease/scripts/fix-names.sh new file mode 100755 index 000000000..9540ac594 --- /dev/null +++ b/autorelease/scripts/fix-names.sh @@ -0,0 +1,42 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015, 2016 The Linux Foundation. All rights reserved. +############################################################################## + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build + +mkdir -p $BUILD_DIR +cd $BUILD_DIR + +# MAP of path to a parent pom from the perspective of hosting directory +# starting from the autorelease repo root. +# +# Format: <groupId>:<artifactId>:<path> + +fix_name() { + pom=$1 + echo -e "\nScanning $pom" + pomPath=`dirname $pom` + + projectPath=${pomPath#*/} # Path to pom file from the perspective of hosting repo + + relativePath="$projectPath" # Calculated relative path to parent pom + + # Update any existing project names + xmlstarlet ed -P -N x=http://maven.apache.org/POM/4.0.0 \ + -u "/x:project/x:name" -v "$relativePath" \ + "$pom" > "${pom}.new" + mv "${pom}.new" "${pom}" + + # Add missing ones + xmlstarlet ed -P -N x=http://maven.apache.org/POM/4.0.0 \ + -s "/x:project[count(x:name)=0]" -t elem -n name -v "$relativePath" \ + "$pom" > "${pom}.new" + mv "${pom}.new" "${pom}" +} + +# Find all project poms ignoring the /src/ paths (We don't want to scan code) +find . -name pom.xml -not -path "*/src/*" | xargs -I^ -P8 bash -c "$(declare -f fix_name); fix_name ^" diff --git a/autorelease/scripts/fix-relativepaths.sh b/autorelease/scripts/fix-relativepaths.sh new file mode 100755 index 000000000..1c9b8d331 --- /dev/null +++ b/autorelease/scripts/fix-relativepaths.sh @@ -0,0 +1,62 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015, 2016 The Linux Foundation. All rights reserved. +############################################################################## + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build + +mkdir -p $BUILD_DIR +cd $BUILD_DIR + +# MAP of path to a parent pom from the perspective of hosting directory +# starting from the autorelease repo root. +# +# Format: <groupId>:<artifactId>:<path> + +fix_relative_paths() { + PARENT_MAP=( + "org.openo.oparent:oparent:oparent" + "org.openo.nfvo:nfvo-root:nfvo" + ) + + pom=$1 + echo "Scanning $pom" + pomPath=`dirname $pom` + + # Find and replace parent poms + for parent in "${PARENT_MAP[@]}"; do + map=${parent#*:} # + + groupId=${parent%%:*} # Maven groupId + artifactId=${map%%:*} # Maven artifactId + projectPath=${map#*:} # Path to pom file from the perspective of hosting repo + + # Compute relative path to parent pom + relativePath=`python -c "import os.path; print os.path.relpath('$projectPath','$pomPath')"` + + # Standardize POM XML formatting + xmlstarlet fo "$pom" > "${pom}.old" + + # Update any existing relativePath values + xmlstarlet ed -P -N x=http://maven.apache.org/POM/4.0.0 \ + -u "//x:parent[x:artifactId=\"$artifactId\" and x:groupId=\"$groupId\"]/x:relativePath" \ + -v "$relativePath" "${pom}" > "${pom}.new1" + + # Add missing ones + xmlstarlet ed -P -N x=http://maven.apache.org/POM/4.0.0 \ + -s "//x:parent[x:artifactId=\"$artifactId\" and x:groupId=\"$groupId\" and count(x:relativePath)=0]" \ + -t elem -n relativePath -v "$relativePath" "${pom}.new1" > "${pom}.new2" + + # Standardize POM XML formatting again + xmlstarlet fo "${pom}.new2" > "${pom}.new" + + diff -u "${pom}.old" "${pom}.new" + cp "${pom}.new" "${pom}" + done +} + +# Find all project poms ignoring the /src/ paths (We don't want to scan code) +find . -name pom.xml -not -path "*/src/*" | sort | xargs -I^ bash -c "$(declare -f fix_relative_paths); fix_relative_paths ^" diff --git a/autorelease/scripts/generate-assembly.py b/autorelease/scripts/generate-assembly.py new file mode 100755 index 000000000..30d5e7516 --- /dev/null +++ b/autorelease/scripts/generate-assembly.py @@ -0,0 +1,82 @@ +#!/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 + +version = "1.1.0-SNAPSHOT" + +root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip() + +with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f: + reader = csv.DictReader(f) + + print """ +<!-- + Copyright (c) 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. +--> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>linux64</id> + <formats> + <format>tar.gz</format> + </formats> + <fileSets> + <fileSet> + <directory>../../distribution</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>**</include> + </includes> + </fileSet> + </fileSets> + <dependencySets> +""" + + for row in reader: + if row["classifier"]: + include = "{}:{}:{}:{}".format(row["groupId"], row["artifactId"], row["extension"], row["classifier"]) + else: + include = "{}:{}:{}".format(row["groupId"], row["artifactId"], row["extension"]) + + txt = """ + <dependencySet> + <outputDirectory>{}</outputDirectory> + <useProjectArtifact>false</useProjectArtifact> + <includes> + <include>{}</include> + </includes> + <outputFileNameMapping>{}-${{artifact.version}}${{dashClassifier?}}.${{artifact.extension}}</outputFileNameMapping> + </dependencySet>""" + # print txt.format(row["filename"], include, row["filename"]) + + + print """ + </dependencySets> +</assembly> +""" diff --git a/autorelease/scripts/generate-binary-deps.py b/autorelease/scripts/generate-binary-deps.py new file mode 100755 index 000000000..aaf18001a --- /dev/null +++ b/autorelease/scripts/generate-binary-deps.py @@ -0,0 +1,38 @@ +#!/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 + +version = "1.1.0-SNAPSHOT" + +root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip() + +with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f: + reader = csv.DictReader(f) + errors = 0 + + items = [] + for row in reader: + txt = """ + <dependency> + <groupId>{}</groupId> + <artifactId>{}</artifactId> + <version>{}</version> + <type>{}</type> + <classifier>{}</classifier> + </dependency>""" + print txt.format(row["groupId"], row["artifactId"], version, row["extension"], row["classifier"]) + diff --git a/autorelease/scripts/generate-distribution-script.py b/autorelease/scripts/generate-distribution-script.py new file mode 100755 index 000000000..67cd26733 --- /dev/null +++ b/autorelease/scripts/generate-distribution-script.py @@ -0,0 +1,72 @@ +#!/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 + +root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip() +url_template = "https://nexus.open-o.org/service/local/artifact/maven/redirect?r=releases&g={0}&a={1}&e={2}&c={3}&v=$VERSION" + +def parseRow(row): + service = row["service"] + filename = row["filename"] + groupId = row["groupId"] + artifactId = row["artifactId"] + extension = row["extension"] + classifier = row["classifier"] + url = url_template.format(groupId, artifactId, extension, classifier) + if classifier: + dest = "{}/{}-$VERSION.{}.{}".format(filename, filename, classifier, extension) + else: + dest = "{}/{}-$VERSION.{}".format(filename, filename, extension) + return {"url": url, "dest": dest} + + +with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f: + reader = csv.DictReader(f) + errors = 0 + + print """ +#!/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. +# + +VERSION=2.0.0 + +set +e + +""" + items = [] + for row in reader: + item = parseRow(row) + items.append(item) + + print "# {}".format(row["service"]) + print "mkdir -p {}".format(row["filename"]) + print "wget -O \"{}\" \"{}\"".format(item["dest"], item["url"]) + print "" diff --git a/autorelease/scripts/generate-jjbs/gen-code-jjbs.sh b/autorelease/scripts/generate-jjbs/gen-code-jjbs.sh new file mode 100755 index 000000000..9432cee54 --- /dev/null +++ b/autorelease/scripts/generate-jjbs/gen-code-jjbs.sh @@ -0,0 +1,191 @@ +#!/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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build +JJB_DIR=$BUILD_DIR/ci-management/jjb + +cd $BUILD_DIR + +source $ROOT/scripts/generate-jjbs/workarounds.sh + + +find . -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort | while read repo; do + project=${repo} + + toxs=`find $repo -type d -exec test -e "{}/tox.ini" ';' -prune -printf "%P/tox.ini\n" | sort` + + in_sun_branch=`git show sun:autorelease/all-projects.txt | grep -x ${repo}` + + mkdir -p $JJB_DIR/$repo + + if [ ! -z "$toxs" ]; then + rm -f $JJB_DIR/$repo/${repo}-python.yaml + + project=${repo}-java + echo $repo/${repo}-python.yaml + + cat > $JJB_DIR/$repo/${repo}-python.yaml <<EOF +--- +- project: + name: ${repo}-python + project: '${repo}' + stream: + - 'master': + branch: 'master' +EOF + if [ $in_sun_branch ]; then + cat >> $JJB_DIR/$repo/${repo}-python.yaml <<EOF + - 'sun': + branch: 'sun' +EOF + fi + cat >> $JJB_DIR/$repo/${repo}-python.yaml <<EOF + mvn-settings: '${repo}-settings' + build-node: 'centos7-redis-2c-1g' + subproject: +EOF + for tox in $toxs; do + toxpath=${tox%/tox.ini} + + if [ "$toxpath" == "" ]; then + subproject="root" + pathparam="." + pattern="**" + else + subproject=${toxpath////-} # replace slash with dash + pathparam=$toxpath + pattern="$toxpath/**" + + # do special subproject names + for SUB in "${SUBPROJECT_MAP[@]}"; do + if [ "${SUB%:*}" = "$repo/$toxpath" ]; then + subproject=${SUB#*:} + fi + done + fi + + cat >> $JJB_DIR/$repo/${repo}-python.yaml <<EOF + - '${subproject}': + path: '${pathparam}' + pattern: '${pattern}' +EOF + done + cat >> $JJB_DIR/$repo/${repo}-python.yaml <<EOF + jobs: + - '{project}-{stream}-{subproject}-verify-python' +EOF + fi + + + + + has_subprojects=0 + for r in "${SPLIT_REPOS[@]}"; do + if [ "$repo" = "$r" ]; then + has_subprojects=1 + fi + done + + if [ $has_subprojects -eq 1 ]; then + poms=`find $repo -mindepth 1 -type d -exec test -e "{}/pom.xml" ';' -prune -printf "%P/pom.xml\n" | sort` + else + poms=`find $repo -type d -exec test -e "{}/pom.xml" ';' -prune -printf "%P/pom.xml\n" | sort` + if [ "$poms" != "/pom.xml" ]; then + has_subprojects=1 + fi + fi + + + if [ ! -z "$poms" ]; then + rm -f $JJB_DIR/$repo/${repo}.yaml + rm -f $JJB_DIR/$repo/${repo}-java.yaml + echo $repo/${project}.yaml + fi + + if [ $has_subprojects -eq 0 ]; then + # root pom.xml found + cat > $JJB_DIR/$repo/${project}.yaml <<EOF +--- +- project: + name: ${project} + jobs: + - '{project}-{stream}-verify-java' + - '{project}-{stream}-merge-java' + + project: '${repo}' + stream: + - 'master': + branch: 'master' +EOF + if [ $in_sun_branch ]; then + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + - 'sun': + branch: 'sun' +EOF + fi + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + mvn-settings: '${repo}-settings' +EOF + elif [ ! -z "$poms" ]; then + cat > $JJB_DIR/$repo/${project}.yaml <<EOF +--- +- project: + name: ${project} + project: '${repo}' + stream: + - 'master': + branch: 'master' +EOF + if [ $in_sun_branch ]; then + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + - 'sun': + branch: 'sun' +EOF + fi + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + mvn-settings: '${repo}-settings' + subproject: +EOF + + for pom in $poms; do + pompath=${pom%/pom.xml} + subproject=${pompath////-} # replace slash with dash + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + - '${subproject}': + pom: '${pom}' + pattern: '${pompath}/**' +EOF + done + + if [ -e $BUILD_DIR/$repo/pom.xml ]; then + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + - 'root': + pom: 'pom.xml' + pattern: '*' +EOF + fi + + cat >> $JJB_DIR/$repo/${project}.yaml <<EOF + jobs: + - '{project}-{stream}-{subproject}-verify-java' + - '{project}-{stream}-{subproject}-merge-java' +EOF + fi +done diff --git a/autorelease/scripts/generate-jjbs/gen-csit-jjbs.sh b/autorelease/scripts/generate-jjbs/gen-csit-jjbs.sh new file mode 100755 index 000000000..539e91115 --- /dev/null +++ b/autorelease/scripts/generate-jjbs/gen-csit-jjbs.sh @@ -0,0 +1,79 @@ +#!/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. +# + +# csit plans root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build +JJB_DIR=$BUILD_DIR/ci-management/jjb + +WORKSPACE=`git rev-parse --show-toplevel` +PLANS_DIR=`git rev-parse --show-toplevel`/test/csit/plans + +source $ROOT/scripts/generate-jjbs/workarounds.sh + + +TMPDIR=`mktemp -d --suffix="-docker-log"` +$ROOT/scripts/ls-microservice-repos.py | cut -d ' ' -f 1 > $TMPDIR/microservices.txt + +find $PLANS_DIR -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort | while read repo; do + + OUTFILE=$JJB_DIR/$repo/${repo}-csit.yaml + cat > $OUTFILE <<EOF +--- +- project: + name: ${repo}-csit + jobs: + - 'integration-verify-{project}-csit-{functionality}' + - '{project}-csit-{functionality}' + project: '${repo}' + functionality: +EOF + find $PLANS_DIR/$repo -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort | while read func; do + echo $repo / $func + cat >> $OUTFILE <<EOF + - '${func}': + trigger_jobs: +EOF + + docker kill `docker ps -a -q` + docker rm `docker ps -a -q` + + $WORKSPACE/test/csit/run-csit.sh plans/${repo}/${func} + mkdir -p $TMPDIR/${repo} + cp $WORKSPACE/archives/_docker-images.log $TMPDIR/${repo}/${func}.txt + + docker kill `docker ps -a -q` + docker rm `docker ps -a -q` + + + for image in `grep openoint $TMPDIR/${repo}/${func}.txt | grep -f $TMPDIR/microservices.txt | sort`; do + microservice=`echo $image | cut -d '/' -f 2` + cat >> $OUTFILE <<EOF + - 'integration-${microservice}-merge-docker' +EOF + done + + done + + cat >> $OUTFILE <<EOF + robot-options: '' + branch: 'master' +EOF +done + +echo $TMPDIR diff --git a/autorelease/scripts/generate-jjbs/gen-docker-jjbs.sh b/autorelease/scripts/generate-jjbs/gen-docker-jjbs.sh new file mode 100755 index 000000000..142892e72 --- /dev/null +++ b/autorelease/scripts/generate-jjbs/gen-docker-jjbs.sh @@ -0,0 +1,66 @@ +#!/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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build +JJB_DIR=$BUILD_DIR/ci-management/jjb + +cd $BUILD_DIR + +# docker root dir +DOCKER=`git rev-parse --show-toplevel`/test/csit/docker + +cd $DOCKER + +OUTFILE=$JJB_DIR/integration/integration-docker-microservices.yaml + +cat > $OUTFILE <<EOF +--- +- project: + name: integration-docker-microservices + project: 'integration' + branch: 'master' + version: '1.1.0-SNAPSHOT' + mvn-settings: 'autorelease-settings' + build-node: 'centos7-robot-8c-8g' + jobs: + - 'integration-{microservice}-verify-docker' + - 'integration-{microservice}-merge-docker' + microservice: +EOF + +TMPDIR=`$ROOT/scripts/generate-jjbs/gen-job-lists.sh` +IFS=$'\n' +for line in `$ROOT/scripts/ls-microservice-repos.py | sort`; do + IFS=' ' + array=($line) + microservice=${array[0]} + repo=${array[1]} + trigger=${array[2]} + echo $microservice $repo $trigger + cat >> $OUTFILE <<EOF + - '${microservice}': + trigger_jobs: +EOF + for job in `cat ${TMPDIR}/merge-jobs/${repo}.txt | grep "${trigger}"`; do + cat >> $OUTFILE <<EOF + - '${job}' +EOF + done +done diff --git a/autorelease/scripts/generate-jjbs/gen-job-lists.sh b/autorelease/scripts/generate-jjbs/gen-job-lists.sh new file mode 100755 index 000000000..4e12c91dc --- /dev/null +++ b/autorelease/scripts/generate-jjbs/gen-job-lists.sh @@ -0,0 +1,64 @@ +#!/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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build +JJB_DIR=$BUILD_DIR/ci-management/jjb + +cd $BUILD_DIR + +source $ROOT/scripts/generate-jjbs/workarounds.sh + + +TMPDIR=`mktemp -d` +echo $TMPDIR + +mkdir -p $TMPDIR/merge-jobs +find . -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort | while read repo; do + project=${repo} + OUTFILE=$TMPDIR/merge-jobs/${repo}.txt + + has_subprojects=0 + for r in "${SPLIT_REPOS[@]}"; do + if [ "$repo" = "$r" ]; then + has_subprojects=1 + fi + done + + if [ $has_subprojects -eq 1 ]; then + poms=`find $repo -mindepth 1 -type d -exec test -e "{}/pom.xml" ';' -prune -printf "%P/pom.xml\n" | sort` + else + poms=`find $repo -type d -exec test -e "{}/pom.xml" ';' -prune -printf "%P/pom.xml\n" | sort` + if [ "$poms" != "/pom.xml" ]; then + has_subprojects=1 + fi + fi + + + if [ $has_subprojects -eq 0 ]; then + echo ${repo}-master-merge-java > $OUTFILE + elif [ ! -z "$poms" ]; then + for pom in $poms; do + pompath=${pom%/pom.xml} + subproject=${pompath////-} # replace slash with dash + echo ${repo}-master-${subproject}-merge-java >> $OUTFILE + done + fi +done + diff --git a/autorelease/scripts/generate-jjbs/workarounds.sh b/autorelease/scripts/generate-jjbs/workarounds.sh new file mode 100755 index 000000000..82b39658c --- /dev/null +++ b/autorelease/scripts/generate-jjbs/workarounds.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. +# + +# specific workarounds to maintain existing job list +rm -f $BUILD_DIR/integration/autorelease/build/pom.xml +rm -f $BUILD_DIR/nfvo/monitor/pom.xml +touch $BUILD_DIR/common-tosca-aria/tox.ini + + +SUBPROJECT_MAP=( + "nfvo/drivers/vnfm/svnfm/zte/vmanager:drv-vnfm-zte" + "nfvo/drivers/vnfm/gvnfm/gvnfmadapter:drv-gvnfm" +) + +SPLIT_REPOS=("nfvo" "common-services-common-utilities" "multivimdriver-openstack" "multivimdriver-vmware-vio") diff --git a/autorelease/scripts/generate-pom.sh b/autorelease/scripts/generate-pom.sh new file mode 100755 index 000000000..5a3286a53 --- /dev/null +++ b/autorelease/scripts/generate-pom.sh @@ -0,0 +1,108 @@ +#!/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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease +VERSION="1.1.0-SNAPSHOT" + +BUILD_DIR=$ROOT/build + +mkdir -p $BUILD_DIR +cd $BUILD_DIR + +FILE=$BUILD_DIR/pom-raw.xml + +cat > $FILE <<EOF +<!-- + Copyright (c) 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. +--> +<!-- AUTOGENERATED by generate-pom.sh; DO NOT MODIFY MANUALLY --> +<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> + <parent> + <groupId>org.openo.oparent</groupId> + <artifactId>oparent</artifactId> + <version>$VERSION</version> + <relativePath>oparent</relativePath> + </parent> + <groupId>org.openo.integration.distribution</groupId> + <artifactId>openo</artifactId> + <packaging>pom</packaging> + <modules> +EOF + +find -mindepth 1 -type d -exec test -e "{}/pom.xml" ';' -prune -printf "%P\n" | sort | while read p; do + if [ $p != "integration/autorelease/build" ]; then + cat >> $FILE <<EOF + <module>$p</module> +EOF + fi +done + +cat >> $FILE <<EOF + </modules> + <dependencies> +EOF + +$ROOT/scripts/generate-binary-deps.py >> $FILE + +cat >> $FILE <<EOF + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <configuration> + <appendAssemblyId>true</appendAssemblyId> + <descriptors> + <descriptor>assembly.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> +EOF + +xmlstarlet fo pom-raw.xml > pom.xml +rm -f pom-raw.xml + +$ROOT/scripts/generate-assembly.py > $BUILD_DIR/assembly.xml diff --git a/autorelease/scripts/get-all-repos.sh b/autorelease/scripts/get-all-repos.sh new file mode 100755 index 000000000..25a4e20e3 --- /dev/null +++ b/autorelease/scripts/get-all-repos.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 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. +# + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +ssh -p 29418 gerrit.open-o.org gerrit ls-projects | grep -vf $ROOT/excluded-projects.txt diff --git a/autorelease/scripts/list-microservices.py b/autorelease/scripts/list-microservices.py new file mode 100755 index 000000000..03c0eb040 --- /dev/null +++ b/autorelease/scripts/list-microservices.py @@ -0,0 +1,29 @@ +#!/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 + +root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip() + +with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f: + reader = csv.DictReader(f) + + rows = [] + for row in reader: + rows.append(row) + + for row in rows: + print " * {:35s} {}".format(row["filename"], row["service"]) diff --git a/autorelease/scripts/ls-microservice-repos.py b/autorelease/scripts/ls-microservice-repos.py new file mode 100755 index 000000000..716bc3dc1 --- /dev/null +++ b/autorelease/scripts/ls-microservice-repos.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 "{} {} {}".format(row["filename"], row["repo"], row["job-trigger-string"]) diff --git a/autorelease/scripts/set-version.sh b/autorelease/scripts/set-version.sh new file mode 100755 index 000000000..3a4503a6d --- /dev/null +++ b/autorelease/scripts/set-version.sh @@ -0,0 +1,33 @@ +#!/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. +# + +VERSION="2.0.0" + +# autorelease root dir +ROOT=`git rev-parse --show-toplevel`/autorelease + +BUILD_DIR=$ROOT/build + +mkdir -p $BUILD_DIR +cd $BUILD_DIR + +if [ -z "$MVN" ]; then + export MVN=`which mvn` +fi + +# Jenkins sets a $MVN parameter via JJB that points to the appropriately installed maven +$MVN -q -f oparent/version/pom.xml versions:set versions:update-child-modules -DnewVersion=${VERSION} diff --git a/autorelease/scripts/verify-binaries.py b/autorelease/scripts/verify-binaries.py new file mode 100755 index 000000000..50f7312ef --- /dev/null +++ b/autorelease/scripts/verify-binaries.py @@ -0,0 +1,62 @@ +#!/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 + +root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).rstrip() +path = "{}/autorelease/dist".format(root) +version = "1.1.0-SNAPSHOT" +url_template = "https://nexus.open-o.org/service/local/artifact/maven/redirect?r=snapshots&g={0}&a={1}&e={2}&c={3}&v=LATEST" + +subprocess.call(["rm", "-rf", path]) +subprocess.call(["mkdir", "-p", path]) + + +def parseRow(row): + service = row["service"] + filename = row["filename"] + groupId = row["groupId"] + artifactId = row["artifactId"] + extension = row["extension"] + classifier = row["classifier"] + url = url_template.format(groupId, artifactId, extension, classifier) + if classifier: + dest = "{}/{}-{}.{}.{}".format(path, filename, version, classifier, extension) + else: + dest = "{}/{}-{}.{}".format(path, filename, version, extension) + return {"url": url, "dest": dest} + + +with open( "{}/autorelease/binaries.csv".format(root), "r" ) as f: + reader = csv.DictReader(f) + errors = 0 + + items = [] + for row in reader: + item = parseRow(row) + items.append(item) + + result = subprocess.call(["wget", "-q", "--spider", "--content-disposition", item["url"]]) + if result == 0: + print "{} OK".format(row["service"]) + else: + errors += 1 + print "{} ERROR: {} not found".format(row["service"], item["url"]) + + print "{} errors found".format(errors) + + if errors > 0: + sys.exit(1) diff --git a/packaging/docker/binaries.csv b/packaging/docker/binaries.csv new file mode 100644 index 000000000..81a9809de --- /dev/null +++ b/packaging/docker/binaries.csv @@ -0,0 +1,64 @@ +repo,job-trigger-string,service,filename,groupId,artifactId,extension,classifier,ports,mysql,mongodb,tomcat,python,unzip-dir +client-cli,,Open-O Command-Line interface (CLI),client-cli,org.openo.client.cli,client-cli-deployment,zip,,,,,,, +client-gui,,Open-O GUI,client-gui,org.openo.client.gui,integration,zip,,9150,,,TRUE,,webapps/openoui +common-services-auth,,Common Services Authentication,common-services-auth,org.openo.common-services.auth,auth-service-deployment,zip,,8102,TRUE,,TRUE,TRUE, +common-services-common-utilities,wso2bpel,Common Services WSO2 Extension,common-services-wso2ext,org.openo.common-services.common-utilities.wso2bpel-ext,standalone,tar.gz,linux64,8101,TRUE,,,, +common-services-driver-mgr,,Common Services Driver Manager,common-services-drivermanager,org.openo.common-services.driver-mgr,drivermanager-service-deployment,zip,,8103,TRUE,,TRUE,, +common-services-external-system-registration,,Common Services External System Register,common-services-extsys,org.openo.common-services.external-system-registration,standalone,tar.gz,linux64,8100,TRUE,,,, +common-services-microservice-bus,,Common Services Microservice Bus,common-services-msb,org.openo.common-services.microservice-bus,msb-core-standalone,tar.gz,linux64,80 8080,,,,, +common-services-protocol-stack,,Common Services Protocol Stack,common-services-protocolstack,org.openo.common-services.protocol-stack,protocolstackservice-deployment,zip,,8109,,,TRUE,, +common-tosca-aria,,Common TOSCA ARIA,common-tosca-aria,org.openo.common-tosca.aria,aria,zip,,8204,,,,TRUE, +common-tosca-catalog,,Common TOSCA Catalog,common-tosca-catalog,org.openo.common-tosca.catalog,catalog-all,tar.gz,linux64,8200,TRUE,,,, +common-tosca-inventory,,Common TOSCA Inventory,common-tosca-inventory,org.openo.common-tosca.inventory,inventory-standalone,zip,bin,8203 3306,TRUE,TRUE,,, +common-tosca-model-designer,,Common TOSCA Model Designer,common-tosca-modeldesigner,org.openo.common-tosca.model-designer.modeldesigner.distribution,modeldesigner-standalone,tar.gz,linux.gtk.x86_64,8202,,,,, +gso,,GSO Service Gateway,gso-service-gateway,org.openo.gso,service-gateway-deployment,zip,,8305,,,TRUE,, +gso,,GSO Service Manager,gso-service-manager,org.openo.gso,servicemanagerservice-deployment,zip,,8301,TRUE,,TRUE,, +gvnfm-vnflcm,,GVNFM Lifecycle Management,gvnfm-vnflcm,org.openo.gvnfm.vnflcm,gvnfm-vnflcm,zip,,8801,TRUE,,,TRUE, +gvnfm-vnfmgr,,GVNFM Init Configuration and Management,gvnfm-vnfmgr,org.openo.gvnfm.vnfmgr,gvnfm-vnfmgr,zip,,8803,TRUE,,,TRUE, +gvnfm-vnfres,,GVNFM Virtual Resource Management,gvnfm-vnfres,org.openo.gvnfm.vnfres,gvnfm-vnfres,zip,,8802,TRUE,,,TRUE, +nfvo,vim-vimadapter,NFVO VIM Driver,nfvo-driver-vim,org.openo.nfvo,vimadapter-deployment,zip,,8481,,,TRUE,, +nfvo,gvnfm-gvnfmadapter,NFVO VNFM Driver GVNFM,nfvo-driver-vnfm-gvnfm,org.openo.nfvo,drivers-vnfm-gvnfm-gvnfmadapter,zip,,8484,,,,TRUE, +nfvo,svnfm-huawei,NFVO VNFM Driver Huawei,nfvo-driver-vnfm-huawei,org.openo.nfvo,hw-vnfmadapter-deployment,zip,,8482,TRUE,,TRUE,, +nfvo,gvnfm-juju,NFVO VNFM Driver JUJU,nfvo-driver-vnfm-juju,org.openo.nfvo,juju-vnfmadapterservice-deployment,zip,,8483,TRUE,,TRUE,, +nfvo,svnfm-zte,NFVO VNFM Driver ZTE,nfvo-driver-vnfm-zte,org.openo.nfvo,drivers-vnfm-svnfm-zte-vmanager,zip,,8410,,,,TRUE, +nfvo,vnfm-ericsson,NFVO VNFM Driver Ericsson,nfvo-driver-vnfm-ericsson,org.openo.nfvo,ericsson-vnfm-driver-deployment,zip,,8485,,,TRUE,, +nfvo,lcm,NFVO Lifecycle Management,nfvo-lcm,org.openo.nfvo,nfvo-lcm,zip,,8403,TRUE,,,TRUE, +nfvo,resmanagement,NFVO Resource Manager,nfvo-resmanagement,org.openo.nfvo,resmanagement-deployment,zip,,8480,TRUE,,TRUE,, +nfvo,monitor-dac,NFVO Monitor Data Acquire Component,nfvo-dac,org.openo.nfvo.monitor.dac.dac-api,dac-standalone,zip,,8206,,,,, +nfvo,monitor-umc,NFVO Monitor Unified Monitor Component,nfvo-umc,org.openo.nfvo.monitor.umc.umc-api,umc-standalone,zip,,8205,TRUE,,,, +nfvo,sdnc-zte,NFVO SDNC Driver ZTE,nfvo-driver-sdnc-zte,org.openo.nfvo.sfc-driver-standalone,nfvo-drivers-sdnc-zte-sfc-driver,zip,,8411,,,,, +policy-designer,,Policy Designer,policy-designer,org.openo.policy.designer,policydesigner-resource,tar.gz,linux64,8901,TRUE,,,, +policy-engine,,Policy Engine,policy-engine,org.openo.policy.engine,policy-engine-core,tar.gz,linux64,8902,,,,, +policy-lcm,,Policy Lcm,policy-lcm,org.openo.policy.lcm,apply,tar.gz,linux64,8903,,,,, +sdnhub-driver-ct-te,,SDNHUB Driver CT TE,sdnhub-driver-ct-te,org.openo.sdnhub.driver-ct-te,ct_tedriver,zip,,8670,,,,TRUE, +sdnhub-driver-huawei-l3vpn,,SDNHUB Driver Huawei L3VPN,sdnhub-driver-huawei-l3vpn,org.openo.sdnhub.driver-huawei-l3vpn,l3vpndriver-deployment,zip,,8533,,,TRUE,, +sdnhub-driver-huawei-openstack,,SDNHUB Driver Huawei Openstack,sdnhub-driver-huawei-openstack,org.openo.sdnhub.driver-huawei-openstack,osdriverservice-deployment,zip,,8539,,,TRUE,, +sdnhub-driver-huawei-overlay,,SDNHUB Driver Huawei Overlay,sdnhub-driver-huawei-overlay,org.openo.sdnhub.driver-huawei-overlay,overlayvpndriver-deployment,zip,,8536,,,TRUE,, +sdnhub-driver-huawei-servicechain,,SDNHUB Driver Huawei Servicechain,sdnhub-driver-huawei-servicechain,org.openo.sdnhub.driver-huawei-servicechain,servicechaindriverservice-deployment,zip,,8542,,,TRUE,, +sdnhub-driver-zte-sptn,,SDNHUB Driver ZTE SPTN,sdnhub-driver-zte-sptn,org.openo.sdnhub.driver-zte-sptn,standalone,tar.gz,linux64,8640,TRUE,,,, +sdno-brs,,SDNO Services BRS,sdno-service-brs,org.openo.sdno.brs,brs-deployment,zip,,8527,,,TRUE,, +sdno-brs,,SDNO Services MSS,sdno-service-mss,org.openo.sdno.brs,mss-deployment,zip,,8530,TRUE,,TRUE,, +sdno-ipsec,,SDNO Services IpSec,sdno-service-ipsec,org.openo.sdno.ipsec,ipsecservice-deployment,zip,,8515,,,TRUE,, +sdno-l2vpn,,SDNO Services L2VPN,sdno-service-l2vpn,org.openo.sdno.l2vpn,l2vpnservice-deployment,zip,,8509,,,TRUE,, +sdno-l3vpn,,SDNO Services L3VPN,sdno-service-l3vpn,org.openo.sdno.l3vpn,l3vpnservice-deployment,zip,,8506,,,TRUE,, +sdno-lcm,,SDNO Services LCM,sdno-service-lcm,org.openo.sdno.lcm,lcm-deployment,zip,,8535,,,,, +sdno-monitoring,,SDNO Monitoring,sdno-monitoring,org.openo.sdno.monitoring,ct_monitoring,zip,,8610,TRUE,,,TRUE, +sdno-nslcm,,SDNO Services Nslcm,sdno-service-nslcm,org.openo.sdno.nslcm,nslcm-deployment,zip,,8545,,,TRUE,, +sdno-optimize,,SDNO Optimize,sdno-optimize,org.openo.sdno.optimize,ct_optimizer,zip,,8620,TRUE,,,TRUE, +sdno-overlay,,SDNO Services Overlay VPN,sdno-service-overlayvpn,org.openo.sdno.overlay,overlayvpnservice-deployment,zip,,8503,,,TRUE,, +sdno-route,,SDNO Services Route,sdno-service-route,org.openo.sdno.route,routeservice-deployment,zip,,8551,,,TRUE,, +sdno-servicechain,,SDNO Services Service Chain,sdno-service-servicechain,org.openo.sdno.servicechain,servicechainservice-deployment,zip,,8521,,,TRUE,, +sdno-site,,SDNO Services Site,sdno-service-site,org.openo.sdno.site,localsiteservice-deployment,zip,,8548,,,TRUE,, +sdno-vpc,,SDNO Services VPC,sdno-service-vpc,org.openo.sdno.vpc,vpcservice-deployment,zip,,8518,,,TRUE,, +sdno-vsitemgr,,SDNO Vsite Manager,sdno-vsitemgr,org.openo.sdno.vsitemgr,ct_vsitemgr,zip,,8600,TRUE,,,TRUE, +sdno-vxlan,,SDNO Services VxLAN,sdno-service-vxlan,org.openo.sdno.vxlan,vxlanservice-deployment,zip,,8512,,,TRUE,, +vnf-sdk-function-test,,VNF SDK Function Test,vnfsdk-function-test,org.openo.vnf-sdk.function-test,standalone,tar.gz,linux64,8701,TRUE,,,, +nfvo,,VNF SDK Function Test Task,vnf-sdk-function-test-task,org.openo.nfvo,nfvo-functest,zip,,8704,TRUE,,,TRUE, +vnf-sdk-marketplace,,VNF SDK Marketplace,vnf-sdk-marketplace,org.openo.vnf-sdk.marketplace,vnf-sdk-marketplace-deployment,zip,,8702,TRUE,,TRUE,, +vnf-sdk-validate-lc-test,,VNF SDK Validate Lifecycle Test,vnf-sdk-validate-lc-test,org.openo.vnf-sdk.validate-lc-test,lifecycle-test-deployment,zip,,8703,,,TRUE,TRUE, +multivimdriver-broker,,MultiVIM broker,multivim-broker,org.openo.multivimdriver.broker,multivimbroker,zip,,9001,TRUE,,,TRUE, +multivimdriver-openstack,newton,MultiVIM driver of OpenStack Newton,multivim-driver-newton,org.openo.multivimdriver.openstack,multivimdriver-openstack-newton,zip,,9003,TRUE,,,TRUE, +multivimdriver-openstack,kilo,MultiVIM driver of OpenStack Kilo,multivim-driver-kilo,org.openo.multivimdriver.openstack,multivimdriver-openstack-kilo,zip,,9002,TRUE,,,TRUE, +multivimdriver-vmware-vio,vio,MultiVIM driver of VMware VIO,multivim-driver-vio,org.openo.multivimdriver.vmware.vio,multivimdriver-vio,zip,,9004,TRUE,,,TRUE, +holmes-engine-management,,Holmes Engine D,holmes-engine-d-standalone,org.openo.holmes.engine-management,holmes-engine-d-standalone,zip,linux64,8750,TRUE,,,, +holmes-rule-management,,Holmes Rulemgt Standalone,holmes-rulemgt-standalone,org.openo.holmes.rule-management,holmes-rulemgt-standalone,zip,linux64,8751,TRUE,,,, 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 |