From d04e4407a6a5888b8f6d924e0c9706378c3d285a Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 28 Jul 2017 12:26:54 -0700 Subject: Add integration scripts from OPEN-O Change-Id: Ife6951ed9ea8c5b9dcea68e7a095b6bd5180e7d1 Signed-off-by: Gary Wu --- autorelease/scripts/autorelease-test.sh | 35 ++++ autorelease/scripts/clone-all.sh | 39 +++++ autorelease/scripts/diff-all.sh | 31 ++++ autorelease/scripts/fix-names.sh | 42 +++++ autorelease/scripts/fix-relativepaths.sh | 62 +++++++ autorelease/scripts/generate-assembly.py | 82 +++++++++ autorelease/scripts/generate-binary-deps.py | 38 ++++ .../scripts/generate-distribution-script.py | 72 ++++++++ autorelease/scripts/generate-jjbs/gen-code-jjbs.sh | 191 +++++++++++++++++++++ autorelease/scripts/generate-jjbs/gen-csit-jjbs.sh | 79 +++++++++ .../scripts/generate-jjbs/gen-docker-jjbs.sh | 66 +++++++ autorelease/scripts/generate-jjbs/gen-job-lists.sh | 64 +++++++ autorelease/scripts/generate-jjbs/workarounds.sh | 29 ++++ autorelease/scripts/generate-pom.sh | 108 ++++++++++++ autorelease/scripts/get-all-repos.sh | 21 +++ autorelease/scripts/list-microservices.py | 29 ++++ autorelease/scripts/ls-microservice-repos.py | 26 +++ autorelease/scripts/set-version.sh | 33 ++++ autorelease/scripts/verify-binaries.py | 62 +++++++ 19 files changed, 1109 insertions(+) create mode 100755 autorelease/scripts/autorelease-test.sh create mode 100755 autorelease/scripts/clone-all.sh create mode 100755 autorelease/scripts/diff-all.sh create mode 100755 autorelease/scripts/fix-names.sh create mode 100755 autorelease/scripts/fix-relativepaths.sh create mode 100755 autorelease/scripts/generate-assembly.py create mode 100755 autorelease/scripts/generate-binary-deps.py create mode 100755 autorelease/scripts/generate-distribution-script.py create mode 100755 autorelease/scripts/generate-jjbs/gen-code-jjbs.sh create mode 100755 autorelease/scripts/generate-jjbs/gen-csit-jjbs.sh create mode 100755 autorelease/scripts/generate-jjbs/gen-docker-jjbs.sh create mode 100755 autorelease/scripts/generate-jjbs/gen-job-lists.sh create mode 100755 autorelease/scripts/generate-jjbs/workarounds.sh create mode 100755 autorelease/scripts/generate-pom.sh create mode 100755 autorelease/scripts/get-all-repos.sh create mode 100755 autorelease/scripts/list-microservices.py create mode 100755 autorelease/scripts/ls-microservice-repos.py create mode 100755 autorelease/scripts/set-version.sh create mode 100755 autorelease/scripts/verify-binaries.py (limited to 'autorelease/scripts') 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: :: + +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: :: + +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 """ + + + linux64 + + tar.gz + + + + ../../distribution + / + + ** + + + + +""" + + 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 = """ + + {} + false + + {} + + {}-${{artifact.version}}${{dashClassifier?}}.${{artifact.extension}} + """ + # print txt.format(row["filename"], include, row["filename"]) + + + print """ + + +""" 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 = """ + + {} + {} + {} + {} + {} + """ + 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 <> $JJB_DIR/$repo/${repo}-python.yaml <> $JJB_DIR/$repo/${repo}-python.yaml <> $JJB_DIR/$repo/${repo}-python.yaml <> $JJB_DIR/$repo/${repo}-python.yaml < $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml < $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml <> $JJB_DIR/$repo/${project}.yaml < $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 <> $OUTFILE <> $OUTFILE <> $OUTFILE < $OUTFILE <> $OUTFILE <> $OUTFILE < $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 < + + + 4.0.0 + + org.openo.oparent + oparent + $VERSION + oparent + + org.openo.integration.distribution + openo + pom + +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 <$p +EOF + fi +done + +cat >> $FILE < + +EOF + +$ROOT/scripts/generate-binary-deps.py >> $FILE + +cat >> $FILE < + + + + + maven-assembly-plugin + 2.6 + + true + + assembly.xml + + + + + make-assembly + package + + single + + + + + + + + +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) -- cgit 1.2.3-korg