@@ -20,35 +20,25 @@ set -xe
2020# We spin up some subprocesses. Don't kill them on hangup
2121trap ' ' HUP
2222
23- # Temporary directory to store any output to display on error
24- export ERROR_OUTPUT_DIR
25- ERROR_OUTPUT_DIR=" $( mktemp -d) "
26- trap ' rm -r "${ERROR_OUTPUT_DIR}"' EXIT
27-
28- delete_app_version () {
29- yes | gcloud --project=" ${GOOGLE_PROJECT_ID} " \
30- app versions delete " ${1} "
31- }
23+ echo " **** ENVIRONMENT ****"
24+ env
3225
33- handle_error () {
34- errcode=$? # Remember the error code so we can exit with it after cleanup
26+ export MAVEN_OPTS=' -Xmx800m -Xms400m'
3527
36- # Clean up remote app version
37- delete_app_version " ${1} " &
28+ # Temporary directory to store any output to display on error
29+ export ERROR_OUTPUT_DIR=" $( mktemp -d) "
30+ trap ' rm -r "${ERROR_OUTPUT_DIR}"' EXIT
3831
39- # Display any errors
40- if [ -n " $( find " ${2} " -mindepth 1 -print -quit) " ]; then
41- cat " ${2:? } " /* 1>&2
32+ # $1 - project
33+ # $2 - PATH
34+ # $3 - search string
35+ function TestIt() {
36+ curl -s --show-error " https://${1} -${URL} /${2} " | \
37+ tee -a " ${ERROR_OUTPUT_DIR} /response.txt" | \
38+ grep " ${3} "
39+ if [ " ${?} " -ne 0 ]; then
40+ echo " ${1} /${2} ****** NOT FOUND"
4241 fi
43-
44- wait
45-
46- exit ${errcode}
47- }
48-
49- cleanup () {
50- delete_app_version " ${GOOGLE_VERSION_ID} " &
51- ( [ -d " ${ERROR_OUTPUT_DIR} " ] && rm -r " ${ERROR_OUTPUT_DIR:? } /" * ) || /bin/true
5242}
5343
5444export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR} /service-acct.json
@@ -75,7 +65,57 @@ gcloud config list
7565
7666echo " ******** build everything ********"
7767cd github/java-docs-samples
78- mvn clean verify | grep -E -v " (^\[INFO\] Download|^\[INFO\].*skipping)"
68+ mvn -B --fail-at-end clean verify -Dbigtable.projectID=" ${GOOGLE_CLOUD_PROJECT} " \
69+ -Dbigtable.instanceID=instance | \
70+ grep -E -v " (^\[INFO\] Download|^\[INFO\].*skipping)"
71+
72+ echo " ******** Deploy to prod *******"
73+ cd appengine-java8
74+
75+ for app in " bigtable" " cloudsql" " datastore" " spanner" \
76+ " urlfetch"
77+ do
78+ (cd " ${app} "
79+ sed --in-place=' .xx' " s/<\/runtime>/<\/runtime><service>${app} <\/service>/" \
80+ src/main/webapp/WEB-INF/appengine-web.xml
81+ mvn -B --fail-at-end -q appengine:deploy -Dapp.deploy.version=" 1" \
82+ -Dapp.stage.quickstart=true -Dapp.deploy.force=true -Dapp.deploy.promote=true \
83+ -Dapp.deploy.project=" ${GOOGLE_CLOUD_PROJECT} " -DskipTests=true
84+ mv src/main/webapp/WEB-INF/appengine-web.xml.xx src/main/webapp/WEB-INF/appengine-web.xml)
85+ done
86+
87+ echo " ******* Test prod Deployed Apps ********"
88+ export URL=" dot-${GOOGLE_CLOUD_PROJECT} .appspot.com"
89+
90+ # TestIt "helloworld" "" "Hello App Engine -- Java 8!"
91+
92+
93+ # # Run tests using App Engine local devserver.
94+ # test_localhost() {
95+ # git clone https://github.com/GoogleCloudPlatform/java-repo-tools.git
96+ #
97+ # devserver_tests=(
98+ # appengine/helloworld
99+ # appengine/datastore/indexes
100+ # appengine/datastore/indexes-exploding
101+ # appengine/datastore/indexes-perfect
102+ # )
103+ # for testdir in "${devserver_tests[@]}" ; do
104+ # if [ -z "$common_dir" ] || [[ $testdir = $common_dir* ]]; then
105+ # ./java-repo-tools/scripts/test-localhost.sh appengine "${testdir}"
106+ # fi
107+ # done
108+
109+ # newplugin_std_tests=(
110+ # appengine/helloworld-new-plugins
111+ # )
112+ # for testdir in "${newplugin_std_tests[@]}" ; do
113+ # ./java-repo-tools/scripts/test-localhost.sh standard_mvn "${testdir}"
114+ # ./java-repo-tools/scripts/test-localhost.sh standard_gradle "${testdir}"
115+ # done
116+ }
117+ test_localhost
118+
79119
80120
81121# (
@@ -98,5 +138,6 @@ mvn clean verify | grep -E -v "(^\[INFO\] Download|^\[INFO\].*skipping)"
98138# ./java-repo-tools/scripts/test-localhost.sh spring-boot helloworld-springboot -- -DskipTests=true
99139
100140# Check that all shell scripts in this repo (including this one) pass the
101- Shell Check linter.
141+ # Shell Check linter.
142+ cd ..
102143shellcheck ./** /* .sh
0 commit comments