Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

fix: use correct retry deadlines #81

Merged
merged 45 commits into from Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
450dd3e
changes without context
yoshi-automation Mar 24, 2021
3138b71
chore(python-library): use sphinx 1.5.5 for the docfx job
yoshi-automation Mar 24, 2021
e5f9451
build(python): use release-publish app for notifying GitHub of releas…
yoshi-automation Mar 24, 2021
5f81c0a
build(python): add secret manager in kokoro
yoshi-automation Mar 24, 2021
363c8f8
chore(python): add sphinx doctest extension
yoshi-automation Mar 24, 2021
8329f31
chore(python): remove note about editable installs
yoshi-automation Mar 24, 2021
ee4679c
chore(python): use BUILD_SPECIFIC_GCLOUD_PROJECT for samples
yoshi-automation Mar 24, 2021
02cc0af
chore(python): use 'setup.py' to detect repo root
yoshi-automation Mar 24, 2021
5e981d9
build(python): samples tests should pass if no samples exist
yoshi-automation Mar 24, 2021
b2bda71
chore(python_library): change the docs bucket name
yoshi-automation Mar 24, 2021
444c55d
chore(docs): update code of conduct of synthtool and templates
yoshi-automation Mar 24, 2021
c3c7425
docs: add proto-plus to intersphinx mapping
yoshi-automation Mar 24, 2021
8cd08a5
fix(python_library): fix external unit test dependencies
yoshi-automation Mar 24, 2021
902c853
chore: add type hint check
yoshi-automation Mar 24, 2021
2b661d1
chore: add blacken to template
yoshi-automation Mar 24, 2021
be92a55
fix: address lint issues
yoshi-automation Mar 24, 2021
f71aaa5
docs(python): update intersphinx for grpc and auth
yoshi-automation Mar 24, 2021
3e7a514
docs(python): fix intersphinx link for google-auth
yoshi-automation Mar 24, 2021
c4d287d
chore: add config / docs for 'pre-commit' support
yoshi-automation Mar 24, 2021
0800754
chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.3.0
yoshi-automation Mar 24, 2021
313d115
test(python): give filesystem paths to pytest-cov
yoshi-automation Mar 24, 2021
01f1c12
chore: update noxfile.py.j2
yoshi-automation Mar 24, 2021
e07d77a
chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.4.0
yoshi-automation Mar 24, 2021
f486d74
docs(python): document adding Python 3.9 support, dropping 3.5 support
yoshi-automation Mar 24, 2021
4583cc9
chore: exclude `.nox` directories from linting
yoshi-automation Mar 24, 2021
3a7ca9f
chore(python): fix column sizing issue in docs
yoshi-automation Mar 24, 2021
e5bd4ee
chore(python): use 'http' in LICENSE
yoshi-automation Mar 24, 2021
a121cdb
chore(python): skip docfx in main presubmit
yoshi-automation Mar 24, 2021
b97f775
chore: add missing quotation mark
yoshi-automation Mar 24, 2021
7f2addd
chore: add 3.9 to noxfile template
yoshi-automation Mar 24, 2021
ad50661
build(python): make `NOX_SESSION` optional
yoshi-automation Mar 24, 2021
a249c43
chore: Add header checker config to python library synth
yoshi-automation Mar 24, 2021
28230fa
chore: add noxfile parameters for extra dependencies
yoshi-automation Mar 24, 2021
f87f3d2
build: migrate to flakybot
yoshi-automation Mar 24, 2021
5c73808
chore(python): include py.typed files in release
yoshi-automation Mar 24, 2021
60b7211
docs: update python contributing guide
yoshi-automation Mar 24, 2021
8a501ba
build(python): enable flakybot on library unit and system tests
yoshi-automation Mar 24, 2021
2f52d9b
test: install pyopenssl for mtls testing
yoshi-automation Mar 24, 2021
bd74581
chore: add pre-commit-config to renovate ignore paths
yoshi-automation Mar 24, 2021
9092f18
build(python): fail nox sessions if a python version is missing
yoshi-automation Mar 24, 2021
3cac5f6
chore(python): add kokoro configs for periodic builds against head
yoshi-automation Mar 24, 2021
f169e35
chore(deps): update precommit hook pycqa/flake8 to v3.9.0
yoshi-automation Mar 24, 2021
01a1b6a
test(python): use constraints files to check dependency lower bounds
yoshi-automation Mar 24, 2021
f32b86c
chore: add constraints files
busunkim96 Apr 1, 2021
809ff83
fix: rename format_ to format
busunkim96 Apr 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 3 additions & 19 deletions .coveragerc
@@ -1,27 +1,11 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# 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
#
# https://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.

# Generated by synthtool. DO NOT EDIT!
[run]
branch = True

[report]
fail_under = 100
show_missing = True
omit = google/cloud/iot/__init__.py
omit =
google/cloud/iot/__init__.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
Expand All @@ -31,4 +15,4 @@ exclude_lines =
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
except pkg_resources.DistributionNotFound
1 change: 1 addition & 0 deletions .flake8
Expand Up @@ -26,6 +26,7 @@ exclude =
*_pb2.py

# Standard linting exemptions.
**/.nox/**
__pycache__,
.git,
*.pyc,
Expand Down
15 changes: 15 additions & 0 deletions .github/header-checker-lint.yml
@@ -0,0 +1,15 @@
{"allowedCopyrightHolders": ["Google LLC"],
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"py",
"html",
"txt"
]
}
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -50,8 +50,10 @@ docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
sponge_log.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
Expand Down
26 changes: 20 additions & 6 deletions .kokoro/build.sh
Expand Up @@ -15,7 +15,11 @@

set -eo pipefail

cd github/python-iot
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/python-iot"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
Expand All @@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
python3 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# If this is a continuous build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
python3 -m nox -s ${NOX_SESSION:-}
else
python3.6 -m nox
python3 -m nox
fi
2 changes: 1 addition & 1 deletion .kokoro/docs/common.cfg
Expand Up @@ -30,7 +30,7 @@ env_vars: {

env_vars: {
key: "V2_STAGING_BUCKET"
value: "docs-staging-v2-staging"
value: "docs-staging-v2"
}

# It will upload the docker image after successful builds.
Expand Down
11 changes: 11 additions & 0 deletions .kokoro/docs/docs-presubmit.cfg
Expand Up @@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-iot/.kokoro/build.sh"
}

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
43 changes: 43 additions & 0 deletions .kokoro/populate-secrets.sh
@@ -0,0 +1,43 @@
#!/bin/bash
# Copyright 2020 Google LLC.
#
# 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.

set -eo pipefail

function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
function msg { println "$*" >&2 ;}
function println { printf '%s\n' "$(now) $*" ;}


# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
mkdir -p ${SECRET_LOCATION}
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
do
msg "Retrieving secret ${key}"
docker run --entrypoint=gcloud \
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
gcr.io/google.com/cloudsdktool/cloud-sdk \
secrets versions access latest \
--project cloud-devrel-kokoro-resources \
--secret ${key} > \
"${SECRET_LOCATION}/${key}"
if [[ $? == 0 ]]; then
msg "Secret written to ${SECRET_LOCATION}/${key}"
else
msg "Error retrieving secret ${key}"
fi
done
50 changes: 13 additions & 37 deletions .kokoro/release/common.cfg
Expand Up @@ -23,42 +23,18 @@ env_vars: {
value: "github/python-iot/.kokoro/release.sh"
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_pypi_password"
}
}
}

# Fetch magictoken to use with Magic Github Proxy
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "releasetool-magictoken"
}
}
# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_pypi_password"
}
}
}

# Fetch api key to use with Magic Github Proxy
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "magic-github-proxy-api-key"
}
}
}
# Tokens needed to report release status back to GitHub
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.6/common.cfg
Expand Up @@ -13,6 +13,12 @@ env_vars: {
value: "py-3.6"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py36"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-iot/.kokoro/test-samples.sh"
Expand Down
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.6/periodic-head.cfg
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.7/common.cfg
Expand Up @@ -13,6 +13,12 @@ env_vars: {
value: "py-3.7"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py37"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-iot/.kokoro/test-samples.sh"
Expand Down
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.7/periodic-head.cfg
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.8/common.cfg
Expand Up @@ -13,6 +13,12 @@ env_vars: {
value: "py-3.8"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py38"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-iot/.kokoro/test-samples.sh"
Expand Down
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.8/periodic-head.cfg
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
28 changes: 28 additions & 0 deletions .kokoro/test-samples-against-head.sh
@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2020 Google LLC
#
# 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
#
# https://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.

# A customized test runner for samples.
#
# For periodic builds, you can specify this file for testing against head.

# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar

cd github/python-iot

exec .kokoro/test-samples-impl.sh