Skip to content

Commit 41e8b92

Browse files
author
Frank Natividad
committed
Added unique strings for maven and gradle deployments
1 parent 399c99f commit 41e8b92

File tree

1 file changed

+11
-5
lines changed
  • appengine/endpoints-frameworks-v2/migration-example

1 file changed

+11
-5
lines changed

appengine/endpoints-frameworks-v2/migration-example/jenkins.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function TestEndpoints () {
2323
curl -X GET \
2424
"https://${2}-dot-${1}.appspot.com/_ah/api/helloworld/v1/hellogreeting/0" | \
2525
tee "$ERROR_OUTPUT_DIR/response.json" | \
26-
grep "hello version-${2}"
26+
grep "hello ${3} version-${2}"
2727

2828
# Test getGreeting Endpoint (goodbye world!)
2929
curl -X GET \
@@ -48,30 +48,36 @@ function TestEndpoints () {
4848

4949
# Jenkins provides values for GOOGLE_PROJECT_ID and GOOGLE_VERSION_ID
5050
# Update Greetings.java
51-
sed -i'.bak' -e "s/hello world!/hello version-${GOOGLE_VERSION_ID}!/g" src/main/java/com/example/helloendpoints/Greetings.java
51+
UNIQUE_MAVEN_STRING="maven"
52+
sed -i'.bak' \
53+
-e "s/hello world!/hello ${UNIQUE_MAVEN_STRING} version-${GOOGLE_VERSION_ID}!/g" \
54+
src/main/java/com/example/helloendpoints/Greetings.java
5255

5356
# Test with Maven
5457
mvn clean appengine:deploy \
5558
-Dapp.deploy.version="${GOOGLE_VERSION_ID}" \
5659
-Dapp.deploy.promote=false
5760

5861
# End-2-End tests
59-
TestEndpoints "${GOOGLE_PROJECT_ID}" "${GOOGLE_VERSION_ID}"
62+
TestEndpoints "${GOOGLE_PROJECT_ID}" "${GOOGLE_VERSION_ID}" "${UNIQUE_MAVEN_STRING}"
6063

6164
# Clean
6265
mvn clean
6366

6467
# Test with Gradle
6568
# Modify Greetings.java for Gradle
66-
sed -i'.bak' -e "s/hello version-${GOOGLE_VERSION_ID}!/hello version-gradle-${GOOGLE_VERSION_ID}!/g" src/main/java/com/example/helloendpoints/Greetings.java
69+
UNIQUE_GRADLE_STRING="gradle"
70+
sed -i'.bak' \
71+
-e "s/hello ${UNIQUE_MAVEN_STRING} version-${GOOGLE_VERSION_ID}!/hello ${UNIQUE_GRADLE_STRING} version-${GOOGLE_VERSION_ID}!/g" \
72+
src/main/java/com/example/helloendpoints/Greetings.java
6773

6874
# Deploy Gradle
6975
gradle -Pappengine.deploy.promote=false \
7076
-Pappengine.deploy.version="${GOOGLE_VERSION_ID}" \
7177
appengineDeploy
7278

7379
# End-2-End tests
74-
TestEndpoints "${GOOGLE_PROJECT_ID}" "gradle-${GOOGLE_VERSION_ID}"
80+
TestEndpoints "${GOOGLE_PROJECT_ID}" "${GOOGLE_VERSION_ID}" "${UNIQUE_GRADLE_STRING}"
7581

7682
# Clean
7783
gradle clean

0 commit comments

Comments
 (0)