File tree 6 files changed +119
-13
lines changed
endpoints-frameworks-v2/discovery
src/main/java/com/example/helloendpoints
6 files changed +119
-13
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,13 @@ dependencies {
48
48
}
49
49
50
50
appengine { // App Engine tasks configuration
51
- run { // local (dev_appserver) configuration (standard environments only)
52
-
53
- }
54
-
55
51
deploy { // deploy configuration
52
+ version = findProperty(" appengine.deploy.version" )
56
53
54
+ def promoteProp = findProperty(" appengine.deploy.promote" )
55
+ if (promoteProp != null ) {
56
+ promote = new Boolean (promoteProp)
57
+ }
57
58
}
58
59
}
59
60
Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /usr/ bin/env bash
2
2
3
3
# Copyright 2017 Google Inc.
4
4
#
@@ -48,7 +48,8 @@ sed -i'.bak' -e "s/hello world!/hello version-${GOOGLE_VERSION_ID}!/g" src/main/
48
48
49
49
# Test with Maven
50
50
mvn clean appengine:deploy \
51
- -Dapp.deploy.version=" ${GOOGLE_VERSION_ID} "
51
+ -Dapp.deploy.version=" ${GOOGLE_VERSION_ID} " \
52
+ -Dapp.deploy.promote=false
52
53
53
54
# End-2-End tests
54
55
TestEndpoints " ${GOOGLE_PROJECT_ID} " " ${GOOGLE_VERSION_ID} "
@@ -57,17 +58,16 @@ TestEndpoints "${GOOGLE_PROJECT_ID}" "${GOOGLE_VERSION_ID}"
57
58
mvn clean
58
59
59
60
# Test with Gradle
60
- # Update build.gradle
61
- sed -i' .bak' -e " s/deploy {/deploy {\n version='${GOOGLE_VERSION_ID} '/g" build.gradle
62
-
63
61
# Modify Greetings.java for Gradle
64
- 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
62
+ sed -i' .bak' -e " s/hello version-${GOOGLE_VERSION_ID} !/hello version-${GOOGLE_VERSION_ID} !/g" src/main/java/com/example/helloendpoints/Greetings.java
65
63
66
64
# Deploy Gradle
67
- gradle appengineDeploy
65
+ gradle -Pappengine.deploy.promote=false \
66
+ -Pappengine.deploy.version=" ${GOOGLE_VERSION_ID} " \
67
+ appengineDeploy
68
68
69
69
# End-2-End tests
70
- TestEndpoints " ${GOOGLE_PROJECT_ID} " " gradle- ${GOOGLE_VERSION_ID} "
70
+ TestEndpoints " ${GOOGLE_PROJECT_ID} " " ${GOOGLE_VERSION_ID} "
71
71
72
72
# Clean
73
73
gradle clean
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public class Greetings {
43
43
public static ArrayList <HelloGreeting > greetings = new ArrayList <HelloGreeting >();
44
44
45
45
static {
46
- greetings .add (new HelloGreeting ("hello world !" ));
46
+ greetings .add (new HelloGreeting ("hello version-jerjou-test !" ));
47
47
greetings .add (new HelloGreeting ("goodbye world!" ));
48
48
}
49
49
//[END api_def]
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Copyright 2017 Google Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ set -xe
18
+
19
+ mvn clean appengine:update \
20
+ -Dappengine.additionalParams=" --service_account_json_key_file=${GOOGLE_APPLICATION_CREDENTIALS} " \
21
+ -Dappengine.appId=" ${GOOGLE_PROJECT_ID} " \
22
+ -Dappengine.version=" ${GOOGLE_VERSION_ID} " \
23
+ -DskipTests=true
24
+
25
+ curl -f " http://${GOOGLE_VERSION_ID} -dot-${GOOGLE_PROJECT_ID} .appspot.com/"
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Copyright 2017 Google Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Fail on non-zero return and print command to stdout
18
+ set -xe
19
+
20
+ # Jenkins Test Script
21
+ function runtests () {
22
+ curl -X GET \
23
+ " https://${2} -dot-${1} .appspot.com/api/users" | \
24
+ grep " ^\\ ["
25
+ }
26
+
27
+ # Jenkins provides values for GOOGLE_PROJECT_ID and GOOGLE_VERSION_ID
28
+
29
+ # Test with Maven
30
+ mvn clean appengine:deploy \
31
+ -Dapp.deploy.version=" ${GOOGLE_VERSION_ID} " \
32
+ -Dapp.deploy.promote=false
33
+
34
+ # End-2-End tests
35
+ runtests " ${GOOGLE_PROJECT_ID} " " ${GOOGLE_VERSION_ID} "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Copyright 2017 Google Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ set -x
18
+ shopt -s globstar
19
+
20
+ delete_app_version () {
21
+ yes | gcloud --project=" $GOOGLE_PROJECT_ID " \
22
+ app versions delete " $GOOGLE_VERSION_ID "
23
+ }
24
+ handle_error () {
25
+ errcode=$? # Remember the error code so we can exit with it after cleanup
26
+
27
+ # Clean up
28
+ delete_app_version
29
+
30
+ exit $errcode
31
+ }
32
+ trap handle_error ERR
33
+
34
+ # First, style-check the shell scripts
35
+ shellcheck ./** /* .sh
36
+
37
+ # Find all jenkins.sh's and run them.
38
+ find . -mindepth 2 -maxdepth 5 -name jenkins.sh -type f | while read path; do
39
+ (
40
+ pushd " ${path% jenkins.sh} "
41
+ /bin/bash ./jenkins.sh
42
+ )
43
+ done
44
+
45
+ delete_app_version
You can’t perform that action at this time.
0 commit comments