Skip to content

Commit e2325fe

Browse files
committed
Add Kokoro config for appengine-datastore
1 parent 3b00ae4 commit e2325fe

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.kokoro/appengine-datastore.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Download secrets from Cloud Storage.
4+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/nodejs-docs-samples"
5+
6+
# Tell the trampoline which build file to use.
7+
env_vars: {
8+
key: "TRAMPOLINE_BUILD_FILE"
9+
value: "github/nodejs-docs-samples/.kokoro/appengine-datastore.sh"
10+
}

.kokoro/appengine-datastore.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# Copyright 2018 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+
export GCLOUD_PROJECT=nodejs-docs-samples-tests
18+
STAGE_BUCKET=$GCLOUD_PROJECT
19+
GCP_REGION=us-central1
20+
21+
export NODE_ENV=development
22+
export GAE_VERSION=appengine-datastore-flexible
23+
24+
# Register post-test cleanup
25+
function cleanup {
26+
CODE=$?
27+
28+
gcloud app versions delete $GAE_VERSION --quiet
29+
if [ -e "worker.yaml" ]; then
30+
gcloud app versions delete ${GAE_VERSION}-worker --quiet
31+
fi
32+
}
33+
trap cleanup EXIT
34+
set -e;
35+
36+
cd github/nodejs-docs-samples/appengine/datastore
37+
38+
# Install dependencies
39+
npm install
40+
41+
# Configure gcloud
42+
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
43+
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
44+
gcloud config set project $GCLOUD_PROJECT
45+
46+
47+
# Deploy the app
48+
gcloud app deploy app.flexible.yaml --version $GAE_VERSION --no-promote --quiet
49+
if [ -e "worker.yaml" ]; then
50+
gcloud app deploy worker.yaml --version ${GAE_VERSION} --no-promote --quiet
51+
fi
52+
53+
54+
# Test the deployed app
55+
npm test
56+
57+
# Exit on error
58+
if [[ $CODE -ne 0 ]]; then
59+
exit $CODE
60+
fi

0 commit comments

Comments
 (0)