|
| 1 | +#!/bin/bash -ex |
| 2 | +# |
| 3 | +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 4 | +# |
| 5 | +# Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved. |
| 6 | +# |
| 7 | +# The contents of this file are subject to the terms of either the GNU |
| 8 | +# General Public License Version 2 only ("GPL") or the Common Development |
| 9 | +# and Distribution License("CDDL") (collectively, the "License"). You |
| 10 | +# may not use this file except in compliance with the License. You can |
| 11 | +# obtain a copy of the License at |
| 12 | +# https://oss.oracle.com/licenses/CDDL+GPL-1.1 |
| 13 | +# or LICENSE.txt. See the License for the specific |
| 14 | +# language governing permissions and limitations under the License. |
| 15 | +# |
| 16 | +# When distributing the software, include this License Header Notice in each |
| 17 | +# file and include the License file at LICENSE.txt. |
| 18 | +# |
| 19 | +# GPL Classpath Exception: |
| 20 | +# Oracle designates this particular file as subject to the "Classpath" |
| 21 | +# exception as provided by Oracle in the GPL Version 2 section of the License |
| 22 | +# file that accompanied this code. |
| 23 | +# |
| 24 | +# Modifications: |
| 25 | +# If applicable, add the following below the License Header, with the fields |
| 26 | +# enclosed by brackets [] replaced by your own identifying information: |
| 27 | +# "Portions Copyright [year] [name of copyright owner]" |
| 28 | +# |
| 29 | +# Contributor(s): |
| 30 | +# If you wish your version of this file to be governed by only the CDDL or |
| 31 | +# only the GPL Version 2, indicate your decision by adding "[Contributor] |
| 32 | +# elects to include this software in this distribution under the [CDDL or GPL |
| 33 | +# Version 2] license." If you don't indicate a single choice of license, a |
| 34 | +# recipient has the option to distribute your version of this file under |
| 35 | +# either the CDDL, the GPL Version 2 or to extend the choice of license to |
| 36 | +# its licensees as provided above. However, if you add GPL Version 2 code |
| 37 | +# and therefore, elected the GPL Version 2 license, then the option applies |
| 38 | +# only if the new code is made subject to such option by the copyright |
| 39 | +# holder. |
| 40 | +# |
| 41 | + |
| 42 | +#set env like CTS_URL [required] , MVN_SETTINGS[optional] , GF_URL [optional] |
| 43 | +METRO_MAJOR_VERSION=2.4.0 |
| 44 | +METRO_REVISION=$BRANCH_NAME |
| 45 | +export WORK_DIR=$WORKSPACE |
| 46 | +echo "WORK_DIR: $WORK_DIR" |
| 47 | +export GF_SVN_ROOT=$WORK_DIR/glassfish |
| 48 | +export DTEST_SVN_ROOT=$GF_SVN_ROOT/appserver/tests/appserv-tests |
| 49 | +export METRO_SVN_ROOT=$WORK_DIR/metro-wsit |
| 50 | + |
| 51 | + |
| 52 | +cd $METRO_SVN_ROOT/wsit/hudson/ |
| 53 | +source common.sh |
| 54 | +if [ -z "$M2_LOCAL_REPO" ]; then |
| 55 | + export M2_LOCAL_REPO=$WORK_DIR/.repository |
| 56 | +fi |
| 57 | + |
| 58 | +#PROXY |
| 59 | +set_proxy |
| 60 | + |
| 61 | +export ANT_OPTS=" $JAVA_PROXY_PROP" |
| 62 | +export MAVEN_OPTS="-Dmaven.repo.local=$M2_LOCAL_REPO -Dmaven.javadoc.skip=true $JAVA_PROXY_PROP" |
| 63 | + |
| 64 | +source setenv.sh |
| 65 | + |
| 66 | +set_common |
| 67 | +print_env |
| 68 | + |
| 69 | +#prepare git source |
| 70 | +pushd $METRO_SVN_ROOT |
| 71 | +git reset --hard |
| 72 | +git clean -fd |
| 73 | +popd |
| 74 | + |
| 75 | + |
| 76 | +if [! -d "$GF_SVN_ROOT" ]; then |
| 77 | + git init $GF_SVN_ROOT |
| 78 | + git clone git@github.com:javaee/glassfish.git |
| 79 | +fi |
| 80 | + |
| 81 | +pushd $GF_SVN_ROOT |
| 82 | +git reset --hard |
| 83 | +git clean -fdx |
| 84 | +popd |
| 85 | + |
| 86 | + |
| 87 | +#fallback to defaults if needed |
| 88 | +if [ -z "$MVN_REPO_URL" ]; then |
| 89 | + MVN_REPO_URL="https://maven.java.net/content/groups/staging" |
| 90 | +fi |
| 91 | + |
| 92 | +if [ -z "$METRO_SVN_REPO" ]; then |
| 93 | + METRO_SVN_REPO=$METRO_FORKED_REPO |
| 94 | +fi |
| 95 | + |
| 96 | +pushd $WORK_DIR |
| 97 | + |
| 98 | +#CLEAN UP |
| 99 | +rm -rf $GF_WORK_DIR |
| 100 | +rm -rf $METRO_WORK_DIR |
| 101 | +rm -f *.patch |
| 102 | +rm -f *.zip |
| 103 | + |
| 104 | +if [ ! -f "$GF_ZIP" -a ! -z "$GF_URL" ]; then |
| 105 | + wget -N $GF_URL |
| 106 | + export GF_ZIP=$WORK_DIR/${GF_URL##*/} |
| 107 | +fi |
| 108 | + |
| 109 | +echo "METRO_VERSION: $METRO_VERSION" |
| 110 | +echo "METRO_REVISION: $METRO_REVISION" |
| 111 | +echo "CTS_ZIP: $CTS_ZIP" |
| 112 | + |
| 113 | +if [[ ! -z $METRO_REVISION ]]; then #generate a temp metro version |
| 114 | + DATESTAMP=`date +%y%m%d.%H%M` |
| 115 | + BUILD_NUMBER=b${DATESTAMP} |
| 116 | + METRO_VERSION=$METRO_MAJOR_VERSION-$BUILD_NUMBER |
| 117 | +fi |
| 118 | + |
| 119 | +METRO_BUNDLE="org/glassfish/metro/metro-standalone" |
| 120 | +if [ -z "$METRO_VERSION" ]; then |
| 121 | + LATEST_METRO_BUILD=`curl -s -k $MVN_REPO_URL/$METRO_BUNDLE/maven-metadata.xml | grep "<version>$METRO_MAJOR_VERSION-b[0-9]" | cut -d ">" -f2,2 | cut -d "<" -f1,1 | tail -1 | cut -d "b" -f2,2` |
| 122 | + METRO_VERSION="$METRO_MAJOR_VERSION-b$LATEST_METRO_BUILD" |
| 123 | + echo "Latest metro build: " $LATEST_METRO_BUILD |
| 124 | + echo "Metro version: " $METRO_VERSION |
| 125 | +fi |
| 126 | + |
| 127 | +if [ -z "$METRO_REVISION" ]; then |
| 128 | + METRO_URL="$MVN_REPO_URL/$METRO_BUNDLE/$METRO_VERSION/metro-standalone-$METRO_VERSION.zip" |
| 129 | + _wget $METRO_URL |
| 130 | + export METRO_ZIP=$WORK_DIR/${METRO_URL##*/} |
| 131 | +fi |
| 132 | + |
| 133 | +if [ ! -f "$CTS_ZIP" ]; then |
| 134 | + wget $CTS_URL |
| 135 | + export CTS_ZIP=$WORK_DIR/${CTS_URL##*/} |
| 136 | +fi |
| 137 | +popd |
| 138 | + |
| 139 | +echo "GF_ZIP: $GF_ZIP" |
| 140 | +echo "METRO_ZIP: $METRO_ZIP" |
| 141 | +echo "CTS_ZIP: $CTS_ZIP" |
| 142 | +echo "Metro SVN root: $METRO_SVN_ROOT" |
| 143 | + |
| 144 | +echo "Preparing WORKDIR:" |
| 145 | +#delete old |
| 146 | +pushd $WORK_DIR |
| 147 | +for dir in "test_results" ".repository" |
| 148 | +do |
| 149 | + if [ -e "$dir" ] ; then |
| 150 | + echo "Removing $dir" |
| 151 | + rm -rf $dir |
| 152 | + fi |
| 153 | +done |
| 154 | +popd |
| 155 | + |
| 156 | +cd $WORK_DIR |
| 157 | +if [ -z "$METRO_URL" ]; then |
| 158 | + if [ ! -z "$METRO_REVISION" ]; then |
| 159 | + rm -rf $METRO_SVN_ROOT || true |
| 160 | + echo "Checking out Metro sources using revision: $METRO_REVISION" |
| 161 | + git clone $METRO_SVN_REPO $METRO_SVN_ROOT |
| 162 | + pushd $METRO_SVN_ROOT/wsit/ |
| 163 | + git checkout $METRO_REVISION |
| 164 | + fi |
| 165 | + JAXB_VERSION=`mvn -s $MVN_SETTINGS dependency:tree -f metro-runtime/metro-runtime-api/pom.xml -Dincludes=com.sun.xml.bind:jaxb-impl | grep com.sun.xml.bind:jaxb-impl | tail -1 | cut -f4 -d':'` |
| 166 | + JAXB_API_VERSION=`mvn -s $MVN_SETTINGS dependency:tree -Dincludes=javax.xml.bind:jaxb-api | grep javax.xml.bind:jaxb-api | tail -1 | cut -f4 -d':'` |
| 167 | + SOAP_API_VERSION=`mvn -s $MVN_SETTINGS dependency:tree -Dincludes=javax.xml.soap:javax.xml.soap-api | grep javax.xml.soap:javax.xml.soap-api | tail -1 | cut -f4 -d':'` |
| 168 | + MIMEPULL_VERSION=`mvn -s $MVN_SETTINGS dependency:tree -Dincludes=org.jvnet.mimepull:mimepull | grep org.jvnet.mimepull:mimepull | tail -1 | cut -f4 -d':'` |
| 169 | + echo "Setting project version in sources to new promoted version $METRO_VERSION" |
| 170 | + #mvn versions:set -Pstaging -DnewVersion="$METRO_VERSION" -f boms/bom/pom.xml -s /net/bat-sca/repine/export2/hudson/tools/maven-3.0.3/settings-nexus.xml |
| 171 | + ./hudson/changeVersion.sh $METRO_MAJOR_VERSION-SNAPSHOT $METRO_VERSION pom.xml |
| 172 | + popd |
| 173 | + |
| 174 | + pushd $GF_SVN_ROOT/appserver |
| 175 | + echo "Updating webservices.version property in GlassFish main pom.xml to $METRO_VERSION" |
| 176 | + perl -i -pe "s|<webservices.version>.*</webservices.version>|<webservices.version>$METRO_VERSION</webservices.version>|g" pom.xml |
| 177 | + echo "Updating jaxb.version property in GlassFish main pom.xml to $JAXB_VERSION" |
| 178 | + perl -i -pe "s|<jaxb.version>.*</jaxb.version>|<jaxb.version>$JAXB_VERSION</jaxb.version>|g" pom.xml |
| 179 | + echo "Updating jaxb-api.version property in GlassFish main pom.xml to $JAXB_API_VERSION" |
| 180 | + perl -i -pe "s|<jaxb-api.version>.*</jaxb-api.version>|<jaxb-api.version>$JAXB_API_VERSION</jaxb-api.version>|g" pom.xml |
| 181 | + echo "Updating javax.xml.soap-api.version property in GlassFish main pom.xml to $SOAP_API_VERSION" |
| 182 | + perl -i -pe "s|<javax.xml.soap-api.version>.*</javax.xml.soap-api.version>|<javax.xml.soap-api.version>$SOAP_API_VERSION</javax.xml.soap-api.version>|g" pom.xml |
| 183 | + |
| 184 | + |
| 185 | + pushd $GF_SVN_ROOT/nucleus |
| 186 | + echo "Updating mimepull.version property in GlassFish nucleus-parent pom.xml to $MIMEPULL_VERSION" |
| 187 | + perl -i -pe "s|<mimepull.version>.*</mimepull.version>|<mimepull.version>$MIMEPULL_VERSION</mimepull.version>|g" pom.xml |
| 188 | + popd |
| 189 | + |
| 190 | + echo "Prepared patch:" |
| 191 | + git diff pom.xml ../nucleus/pom.xml packager/resources/pkg_conf.py |
| 192 | + echo "back-uping original pom.xml" |
| 193 | + cp pom.xml pom.xml.orig |
| 194 | + echo "Adding staging repository definition to GlassFish's pom.xml" |
| 195 | + perl -i -pe "s|</project>|<repositories><repository><id>staging.java.net</id><url>$MVN_REPO_URL</url></repository></repositories></project>|g" pom.xml |
| 196 | + popd |
| 197 | + |
| 198 | + echo -e "\nBuilding projects:" |
| 199 | + for project in "$METRO_SVN_ROOT/wsit/" "$GF_SVN_ROOT" |
| 200 | + do |
| 201 | + echo "Building $project" |
| 202 | + pushd $project |
| 203 | + # mvn -s $MVN_SETTINGS -U -C -DskipTests=true clean install |
| 204 | + mvn -s $MVN_SETTINGS -U -C clean install |
| 205 | + popd |
| 206 | + echo "$project done" |
| 207 | + done |
| 208 | + echo -e "\nDone building projects\n" |
| 209 | + |
| 210 | + pushd $GF_SVN_ROOT/appserver |
| 211 | + echo "Restoring GlassFish's pom.xml" |
| 212 | + rm -f pom.xml |
| 213 | + mv pom.xml.orig pom.xml |
| 214 | + popd |
| 215 | +fi |
| 216 | + |
| 217 | +export RESULTS_DIR=$WORK_DIR/test_results |
| 218 | +export DEVTESTS_RESULTS_DIR=$RESULTS_DIR/devtests |
| 219 | +export CTS_RESULTS_DIR=$RESULTS_DIR/cts-smoke |
| 220 | + |
| 221 | +pushd "$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 222 | + |
| 223 | +mkdir -p $RESULTS_DIR |
| 224 | +export ALL=$RESULTS_DIR/test-summary.txt |
| 225 | +rm -f $ALL || true |
| 226 | +touch $ALL |
| 227 | +echo "Tested configuration:" >> $ALL |
| 228 | +echo -e "\nJAVA_HOME: $JAVA_HOME" >> $ALL |
| 229 | + |
| 230 | +if [ -z "$GF_URL" ]; then |
| 231 | + pushd $GF_SVN_ROOT |
| 232 | + echo "GlassFish: `git status $GF_SVN_ROOT`" >> $ALL |
| 233 | + popd |
| 234 | +else |
| 235 | + echo "GlassFish: $GF_URL" >> $ALL |
| 236 | +fi |
| 237 | +if [ -z "$METRO_URL" ]; then |
| 238 | + pushd $METRO_SVN_ROOT |
| 239 | + echo "Metro: `git status`\n" >> $ALL |
| 240 | + popd |
| 241 | +else |
| 242 | + echo "Metro: $METRO_URL\n" >> $ALL |
| 243 | +fi |
| 244 | + |
| 245 | + |
| 246 | +pushd $METRO_SVN_ROOT/wsit/hudson/ |
| 247 | + |
| 248 | +./cts-smoke.sh -g $GF_ZIP -c $CTS_ZIP |
| 249 | +mkdir -p $CTS_RESULTS_DIR |
| 250 | +mv $WORK_DIR/test_results-cts/* $CTS_RESULTS_DIR |
| 251 | +rm -rf $WORK_DIR/test_results-cts |
| 252 | +cp $GF_WORK_DIR/glassfish5/glassfish/domains/domain1/logs/server.log* $CTS_RESULTS_DIR |
| 253 | +mv $WORK_DIR/test-cts-smoke.log.txt $RESULTS_DIR |
| 254 | +popd |
| 255 | + |
| 256 | +if [ ! "`grep 'Failed.' $CTS_RESULTS_DIR/text/summary.txt`" ]; then |
| 257 | + echo -e "\nCTS-smoke tests: OK\n" >> $ALL |
| 258 | +else |
| 259 | + echo -e "\nCTS-smoke tests: `grep -c 'Failed.' $CTS_RESULTS_DIR/text/summary.txt` failure(s)" >> $ALL |
| 260 | + grep "Failed." $CTS_RESULTS_DIR/text/summary.txt >> $ALL |
| 261 | + cat $ALL |
| 262 | +# exit 1 |
| 263 | +fi |
| 264 | +if [ "`grep 'BUILD FAILED' $RESULTS_DIR/test-cts-smoke.log.txt`" ]; then |
| 265 | + echo "CTS-smoke tests: build failure" >> $ALL |
| 266 | + cat $ALL |
| 267 | +# exit 1 |
| 268 | +fi |
| 269 | + |
| 270 | +pushd $METRO_SVN_ROOT/wsit/hudson/ |
| 271 | + |
| 272 | +for QL_TEST_PROFILE in "all" |
| 273 | +do |
| 274 | + export QL_RESULTS_DIR=$RESULTS_DIR/quick_look-$QL_TEST_PROFILE |
| 275 | + ./quicklook.sh -g $GF_ZIP -p $QL_TEST_PROFILE |
| 276 | + mkdir -p $QL_RESULTS_DIR |
| 277 | + pushd $GF_SVN_ROOT/appserver/tests/quicklook |
| 278 | + cp quicklook_summary.txt *.output $QL_RESULTS_DIR |
| 279 | + popd |
| 280 | + cp $GF_WORK_DIR/glassfish5/glassfish/domains/domain1/logs/server.log* $QL_RESULTS_DIR |
| 281 | + mv $WORK_DIR/test-quicklook-$QL_TEST_PROFILE.log.txt $RESULTS_DIR |
| 282 | + |
| 283 | + if [ "`grep -E '.*Failures: 0.*' $QL_RESULTS_DIR/quicklook_summary.txt`" ]; then |
| 284 | + echo -e "\nQuickLook tests: OK\n" >> $ALL |
| 285 | + else |
| 286 | + echo -e "\nQuickLook tests: `awk '/,/ { print $6 }' $QL_RESULTS_DIR/quicklook_summary.txt | cut -d ',' -f 1` failure(s)" >> $ALL |
| 287 | + grep "FAILED:" $RESULTS_DIR/test-quicklook-$QL_TEST_PROFILE.log.txt >> $ALL |
| 288 | + cat $ALL |
| 289 | + exit 1 |
| 290 | + fi |
| 291 | + |
| 292 | + if [ "`grep -E '.*Configuration Failures:.*' $QL_RESULTS_DIR/quicklook_summary.txt`" ]; then |
| 293 | + echo -e "\nQuickLook tests: `awk '/,/ { print $3 }' $QL_RESULTS_DIR/quicklook_summary.txt | cut -d ',' -f 1 | cut -d ':' -f 2` configuration failure(s)" >> $ALL |
| 294 | + grep "FAILED CONFIGURATION:" $RESULTS_DIR/test-quicklook-$QL_TEST_PROFILE.log.txt >> $ALL |
| 295 | + echo -e "\nQuickLook tests: `awk '/,/ { print $8 }' $QL_RESULTS_DIR/quicklook_summary.txt | cut -d ',' -f 1` skip(s)" >> $ALL |
| 296 | + grep "SKIPPED:" $RESULTS_DIR/test-quicklook-$QL_TEST_PROFILE.log.txt >> $ALL |
| 297 | + cat $ALL |
| 298 | + exit 1 |
| 299 | + fi |
| 300 | + |
| 301 | + if [ "`grep 'BUILD FAILURE' $RESULTS_DIR/test-quicklook-$QL_TEST_PROFILE.log.txt`" ]; then |
| 302 | + echo "QuickLook tests ($QL_TEST_PROFILE): build failure" >> $ALL |
| 303 | + cat $ALL |
| 304 | + exit 1 |
| 305 | + fi |
| 306 | +done |
| 307 | + |
| 308 | +#Disable devtest due to test has not been moved to app-test and build issue. |
| 309 | +# pushd $METRO_SVN_ROOT/wsit/hudson/ |
| 310 | +# ./devtests.sh -g $GF_ZIP |
| 311 | +# mkdir -p $DEVTESTS_RESULTS_DIR |
| 312 | +# pushd $DTEST_SVN_ROOT |
| 313 | +# cp test_results.* $DEVTESTS_RESULTS_DIR |
| 314 | +# pushd devtests/webservice |
| 315 | +# cp webservice.output $DEVTESTS_RESULTS_DIR/webservice.output.txt |
| 316 | +# #cp count.txt $DEVTESTS_RESULTS_DIR |
| 317 | +# popd |
| 318 | +# popd |
| 319 | +# cp $GF_WORK_DIR/glassfish5/glassfish/domains/domain1/logs/server.log* $DEVTESTS_RESULTS_DIR |
| 320 | +# mv $WORK_DIR/test-devtests.log.txt $RESULTS_DIR |
| 321 | +# |
| 322 | +# if [ "`grep 'Java Result: -1' $RESULTS_DIR/test-devtests.log.txt`" ]; then |
| 323 | +# #TODO: break the build after fixing appserv-tests/devtests/webservice/ejb_annotations/ejbwebservicesinwar-2 |
| 324 | +# echo -e "\ndevtests tests: TODO - fix devtests/webservice/ejb_annotations/ejbwebservicesinwar-2" >> $ALL |
| 325 | +# fi |
| 326 | +# if [ "`grep -E 'FAILED=( )+0' $DEVTESTS_RESULTS_DIR/count.txt`" ]; then |
| 327 | +# echo -e "\ndevtests tests: OK\n" >> $ALL |
| 328 | +# else |
| 329 | +# echo -e "\ndevtests tests: `awk '/FAILED=( )+/ { print $2 }' $DEVTESTS_RESULTS_DIR/count.txt` failure(s)" >> $ALL |
| 330 | +# grep ": FAIL" $DEVTESTS_RESULTS_DIR/webservice.output.txt >> $ALL |
| 331 | +# cat $ALL |
| 332 | +# # exit 1 |
| 333 | +# fi |
| 334 | +# if [ "`grep 'BUILD FAILED' $RESULTS_DIR/test-devtests.log.txt`" ]; then |
| 335 | +# echo "devtests tests: build failure" >> $ALL |
| 336 | +# cat $ALL |
| 337 | +# # exit 1 |
| 338 | +# fi |
| 339 | +if [ -z "$METRO_REVISION" ]; then #create patch only for public metro |
| 340 | + pushd $GF_SVN_ROOT |
| 341 | + |
| 342 | + git config user.name $JOB_GIT_USERNAME |
| 343 | + git config user.email $JOB_GIT_EMAIL |
| 344 | + |
| 345 | + git add pom.xml appserver/pom.xml nucleus/pom.xml |
| 346 | + git commit -m "PATCH with "+$METRO_VERSION |
| 347 | + git format-patch -1 |
| 348 | + git reset --hard HEAD~1 |
| 349 | + mv *.patch $WORKDIR |
| 350 | + echo "Patch created!" |
| 351 | +fi |
0 commit comments