Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate tests to Kokoro #652

Merged
merged 7 commits into from
Jun 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .kokoro/appengine-datastore.cfg

This file was deleted.

13 changes: 13 additions & 0 deletions .kokoro/appengine/analytics-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "analytics"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/analytics-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "analytics"
}
53 changes: 53 additions & 0 deletions .kokoro/appengine/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

export GCLOUD_PROJECT=nodejs-docs-samples-tests

export NODE_ENV=development
export GAE_VERSION=appengine-${PROJECT}-${APPENGINE_ENVIRONMENT}

# Register post-test cleanup
function cleanup {
gcloud app versions delete $GAE_VERSION --quiet
if [ -e "worker.yaml" ]; then
gcloud app versions delete ${GAE_VERSION}-worker --quiet
fi
}
trap cleanup EXIT
set -e;

cd github/nodejs-docs-samples/appengine/${PROJECT}

# Install dependencies
npm install

# Configure gcloud
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
gcloud config set project $GCLOUD_PROJECT


# Deploy the app
gcloud app deploy app.${APPENGINE_ENVIRONMENT}.yaml --version $GAE_VERSION --no-promote --quiet
if [ -e "worker.yaml" ]; then
gcloud app deploy worker.yaml --version ${GAE_VERSION} --no-promote --quiet
fi


# Test the deployed app
npm test

exit $?
22 changes: 22 additions & 0 deletions .kokoro/appengine/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Download secrets from Cloud Storage.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/nodejs-docs-samples"

# All builds use the trampoline script to run in docker.
build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-docs-samples/nodejs"
}

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-docs-samples/.kokoro/appengine/build.sh"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/datastore-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "datastore"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/datastore-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "datastore"
}
53 changes: 53 additions & 0 deletions .kokoro/appengine/default-yml/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

export GCLOUD_PROJECT=nodejs-docs-samples-tests

export NODE_ENV=development
export GAE_VERSION=appengine-${PROJECT}-${APPENGINE_ENVIRONMENT}

# Register post-test cleanup
function cleanup {
gcloud app versions delete $GAE_VERSION --quiet
if [ -e "worker.yaml" ]; then
gcloud app versions delete ${GAE_VERSION}-worker --quiet
fi
}
trap cleanup EXIT
set -e;

cd github/nodejs-docs-samples/appengine/${PROJECT}/${APPENGINE_ENVIRONMENT}

# Install dependencies
npm install

# Configure gcloud
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
gcloud config set project $GCLOUD_PROJECT


# Deploy the app
gcloud app deploy --version $GAE_VERSION --no-promote --quiet
if [ -e "worker.yaml" ]; then
gcloud app deploy worker.yaml --version ${GAE_VERSION} --no-promote --quiet
fi


# Test the deployed app
npm test

exit $?
22 changes: 22 additions & 0 deletions .kokoro/appengine/default-yml/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Download secrets from Cloud Storage.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/nodejs-docs-samples"

# All builds use the trampoline script to run in docker.
build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-docs-samples/nodejs"
}

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-docs-samples/.kokoro/appengine/default-yml/build.sh"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/default-yml/hello-world-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "hello-worl"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/default-yml/hello-world-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "hello-worl"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/default-yml/metadata-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "metadata"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/default-yml/metadata-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "metadata"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/default-yml/storage-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "storage"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/default-yml/storage-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "storage"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/endpoints-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "endpoints"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/endpoints-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "endpoints"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/errorreporting-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "errorreporting"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/errorreporting-standard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "standard"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "errorreporting"
}
13 changes: 13 additions & 0 deletions .kokoro/appengine/mailjet-flex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set GAE environment
env_vars: {
key: "APPENGINE_ENVIRONMENT"
value: "flexible"
}

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "mailjet"
}
Loading