Skip to content

Commit cdc480d

Browse files
committed
buildscripts: fix error using cmd output rather than $?
1 parent 450a983 commit cdc480d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

buildscripts/kokoro/gae-interop.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,20 @@ echo "<?xml version='1.0' encoding='utf-8'?>
3333
</appengine-web-app>
3434
" > ./gae-interop-testing/gae-jdk8/src/main/webapp/WEB-INF/appengine-web.xml
3535
cat ./gae-interop-testing/gae-jdk8/src/main/webapp/WEB-INF/appengine-web.xml
36-
# Deploy the dummy 'default' version. It doesn't matter if we race with other kokoro runs.
37-
# We only require that it exists when cleanup() is called.
38-
if [[ $(gcloud app versions describe $DUMMY_DEFAULT_VERSION --service=$KOKORO_GAE_SERVICE) != 0 ]]; then
39-
./gradlew --stacktrace -DgaeDeployVersion=$DUMMY_DEFAULT_VERSION -DgaeStopPreviousVersion=false -DgaePromote=false -PskipCodegen=true :grpc-gae-interop-testing-jdk8:appengineDeploy
36+
37+
GRADLE_FLAGS="--stacktrace -DgaeStopPreviousVersion=false -DgaePromote=false -PskipCodegen=true"
38+
DUMMY_EXISTS_CMD="gcloud app versions describe $DUMMY_DEFAULT_VERSION --service=$KOKORO_GAE_SERVICE"
39+
DEPLOY_DUMMY_CMD="./gradlew $GRADLE_FLAGS -DgaeDeployVersion=$DUMMY_DEFAULT_VERSION :grpc-gae-interop-testing-jdk8:appengineDeploy"
40+
41+
# Deploy the dummy 'default' version. We only require that it exists when cleanup() is called.
42+
set +e
43+
$DUMMY_EXISTS_CMD
44+
set -e
45+
46+
if [[ $? != 0 ]]; then
47+
$DEPLOY_DUMMY_CMD
48+
else
49+
echo "default version already exists: $DUMMY_DEFAULT_VERSION"
4050
fi
4151

4252
##
@@ -51,7 +61,7 @@ echo "<?xml version='1.0' encoding='utf-8'?>
5161
" > ./gae-interop-testing/gae-jdk8/src/main/webapp/WEB-INF/appengine-web.xml
5262
cat ./gae-interop-testing/gae-jdk8/src/main/webapp/WEB-INF/appengine-web.xml
5363
# Deploy and test the real app (jdk8)
54-
./gradlew --stacktrace -DgaeDeployVersion=$KOKORO_GAE_APP_VERSION -DgaeStopPreviousVersion=false -DgaePromote=false -PskipCodegen=true :grpc-gae-interop-testing-jdk8:runInteropTestRemote
64+
./gradlew $GRADLE_FLAGS -DgaeDeployVersion=$KOKORO_GAE_APP_VERSION :grpc-gae-interop-testing-jdk8:runInteropTestRemote
5565

5666
##
5767
## Begin JDK7 test
@@ -65,4 +75,4 @@ echo "<?xml version='1.0' encoding='utf-8'?>
6575
" > ./gae-interop-testing/gae-jdk7/src/main/webapp/WEB-INF/appengine-web.xml
6676
cat ./gae-interop-testing/gae-jdk7/src/main/webapp/WEB-INF/appengine-web.xml
6777
# Deploy and test the real app (jdk7)
68-
./gradlew --stacktrace -DgaeDeployVersion=$KOKORO_GAE_APP_VERSION -DgaeStopPreviousVersion=false -DgaePromote=false -PskipCodegen=true :grpc-gae-interop-testing-jdk7:runInteropTestRemote
78+
./gradlew $GRADLE_FLAGS -DgaeDeployVersion=$KOKORO_GAE_APP_VERSION :grpc-gae-interop-testing-jdk7:runInteropTestRemote

0 commit comments

Comments
 (0)