Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit d020426

Browse files
author
Jon Wayne Parrott
authored
Adding kokoro config (#176)
1 parent 1c51e93 commit d020426

5 files changed

Lines changed: 83 additions & 1 deletion

File tree

.kokoro/common.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
4+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
5+
6+
# All builds use the trampoline script to run in docker.
7+
build_file: "google-auth-library-python/.kokoro/trampoline.sh"
8+
9+
# Use the Python worker docker iamge.
10+
env_vars: {
11+
key: "TRAMPOLINE_IMAGE"
12+
value: "gcr.io/silver-python2/python-worker"
13+
}

.kokoro/system_tests.cfg

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Download secrets from Cloud Storage.
4+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-auth-library-python"
5+
6+
# Tell the trampoline which build file to use.
7+
env_vars: {
8+
key: "TRAMPOLINE_BUILD_FILE"
9+
value: "github/google-auth-library-python/.kokoro/system_tests.sh"
10+
}
11+
12+
# Tell the system tests which Google Cloud project to use.
13+
env_vars: {
14+
key: "TEST_PROJECT"
15+
value: "python-docs-samples-tests"
16+
}

.kokoro/system_tests.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/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 -eo pipefail
18+
19+
export PATH=${PATH}:${HOME}/gcloud/google-cloud-sdk/bin
20+
21+
cd github/google-auth-library-python
22+
23+
# Unencrypt and extract secrets
24+
SECRETS_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secrets-password.txt")
25+
./scripts/decrypt-secrets.sh "${SECRETS_PASSWORD}"
26+
27+
# Setup gcloud, this is needed for the App Engine system test.
28+
gcloud auth activate-service-account --key-file system_tests/data/service_account.json
29+
gcloud config set project "${TEST_PROJECT}"
30+
31+
# Run tests
32+
tox -e py27-system
33+
tox -e py36-system

.kokoro/trampoline.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/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+
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"

system_tests/test_compute_engine.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717
import google.auth
1818
from google.auth import _helpers
1919
from google.auth import compute_engine
20+
from google.auth import exceptions
2021
from google.auth.compute_engine import _metadata
2122

2223

2324
@pytest.fixture(autouse=True)
2425
def check_gce_environment(http_request):
25-
if not _metadata.ping(http_request, timeout=1):
26+
try:
27+
_metadata.get_service_account_info(http_request)
28+
except exceptions.TransportError:
2629
pytest.skip('Compute Engine metadata service is not available.')
2730

2831

0 commit comments

Comments
 (0)