Skip to content

Commit b6df143

Browse files
authored
Add Kokoro config for appengine-datastore (#642)
1 parent fd0bf0e commit b6df143

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.kokoro/appengine-datastore.cfg

+10
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

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
19+
export NODE_ENV=development
20+
export GAE_VERSION=appengine-datastore-flexible
21+
22+
# Register post-test cleanup
23+
function cleanup {
24+
gcloud app versions delete $GAE_VERSION --quiet
25+
if [ -e "worker.yaml" ]; then
26+
gcloud app versions delete ${GAE_VERSION}-worker --quiet
27+
fi
28+
}
29+
trap cleanup EXIT
30+
set -e;
31+
32+
cd github/nodejs-docs-samples/appengine/datastore
33+
34+
# Install dependencies
35+
npm install
36+
37+
# Configure gcloud
38+
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
39+
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
40+
gcloud config set project $GCLOUD_PROJECT
41+
42+
43+
# Deploy the app
44+
gcloud app deploy app.flexible.yaml --version $GAE_VERSION --no-promote --quiet
45+
if [ -e "worker.yaml" ]; then
46+
gcloud app deploy worker.yaml --version ${GAE_VERSION} --no-promote --quiet
47+
fi
48+
49+
50+
# Test the deployed app
51+
npm test
52+
53+
exit $?

0 commit comments

Comments
 (0)