Skip to content

Commit 4d1b8d3

Browse files
ci(spanner): use airlock for presubmit jobs
1 parent 592047f commit 4d1b8d3

File tree

7 files changed

+217
-3
lines changed

7 files changed

+217
-3
lines changed

.kokoro/build.sh

+17
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
4646
trap cleanup EXIT HUP
4747
fi
4848

49+
set -x
50+
if [[ $USE_AIRLOCK = 'true' ]]; then
51+
cat > $HOME/.pypirc <<EOL
52+
[distutils]
53+
index-servers =
54+
python-3p-trusted
55+
56+
[python-3p-trusted]
57+
repository = https://us-python.pkg.dev/artifact-foundry-prod/python-3p-trusted/
58+
EOL
59+
mkdir -p $HOME/.config/pip
60+
cat > $HOME/.config/pip/pip.conf <<EOL
61+
[global]
62+
index-url = https://us-python.pkg.dev/artifact-foundry-prod/python-3p-trusted/simple/
63+
EOL
64+
fi
65+
4966
# If NOX_SESSION is set, it only runs the specified session,
5067
# otherwise run all the sessions.
5168
if [[ -n "${NOX_SESSION:-}" ]]; then

.kokoro/presubmit/system-3.8.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44
env_vars: {
55
key: "NOX_SESSION"
66
value: "system-3.8"
7+
}
8+
9+
env_vars: {
10+
key: "USE_AIRLOCK"
11+
value: "true"
712
}

.kokoro/requirements-auth.txt

+64
Large diffs are not rendered by default.

noxfile.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,17 @@
8585
"format",
8686
]
8787

88+
8889
# Error if a python version is missing
8990
nox.options.error_on_missing_interpreters = True
9091

92+
def install_default_packages(session):
93+
if os.environ.get("USE_AIRLOCK") == "true":
94+
session.install("-r", ".kokoro/requirements-auth.txt", "-i", "https://pypi.org/simple/", "--require-hashes", "--only-binary", ":all:")
9195

9296
@nox.session(python=DEFAULT_PYTHON_VERSION)
9397
def lint(session):
98+
install_default_packages(session)
9499
"""Run linters.
95100
96101
Returns a failure if the linters find linting errors or sufficiently
@@ -107,6 +112,7 @@ def lint(session):
107112

108113
@nox.session(python=DEFAULT_PYTHON_VERSION)
109114
def blacken(session):
115+
install_default_packages(session)
110116
"""Run black. Format code to uniform standard."""
111117
session.install(BLACK_VERSION)
112118
session.run(
@@ -117,6 +123,7 @@ def blacken(session):
117123

118124
@nox.session(python=DEFAULT_PYTHON_VERSION)
119125
def format(session):
126+
install_default_packages(session)
120127
"""
121128
Run isort to sort imports. Then run black
122129
to format code to uniform standard.
@@ -137,12 +144,15 @@ def format(session):
137144

138145
@nox.session(python=DEFAULT_PYTHON_VERSION)
139146
def lint_setup_py(session):
147+
install_default_packages(session)
140148
"""Verify that setup.py is valid (including RST check)."""
141149
session.install("docutils", "pygments")
142150
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
143151

144152

145153
def install_unittest_dependencies(session, *constraints):
154+
install_default_packages(session)
155+
146156
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
147157
session.install(*standard_deps, *constraints)
148158

@@ -238,6 +248,7 @@ def unit(session, protobuf_implementation):
238248
@nox.session(python=DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION)
239249
def mockserver(session):
240250
# Install all test dependencies, then install this package in-place.
251+
install_default_packages(session)
241252

242253
constraints_path = str(
243254
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
@@ -267,6 +278,7 @@ def install_systemtest_dependencies(session, *constraints):
267278
# Use pre-release gRPC for system tests.
268279
# Exclude version 1.52.0rc1 which has a known issue.
269280
# See https://github.com/grpc/grpc/issues/32163
281+
install_default_packages(session)
270282
session.install("--pre", "grpcio!=1.52.0rc1")
271283

272284
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)
@@ -292,7 +304,6 @@ def install_systemtest_dependencies(session, *constraints):
292304
else:
293305
session.install("-e", ".", *constraints)
294306

295-
296307
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
297308
@nox.parametrize("database_dialect", ["GOOGLE_STANDARD_SQL", "POSTGRESQL"])
298309
def system(session, database_dialect):
@@ -363,6 +374,7 @@ def cover(session):
363374
This outputs the coverage report aggregating coverage from the unit
364375
test runs (not system test runs), and then erases coverage data.
365376
"""
377+
install_default_packages(session)
366378
session.install("coverage", "pytest-cov")
367379
session.run("coverage", "report", "--show-missing", "--fail-under=98")
368380

@@ -372,7 +384,7 @@ def cover(session):
372384
@nox.session(python="3.10")
373385
def docs(session):
374386
"""Build the docs for this library."""
375-
387+
install_default_packages(session)
376388
session.install("-e", ".[tracing]")
377389
session.install(
378390
# We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -407,7 +419,7 @@ def docs(session):
407419
@nox.session(python="3.10")
408420
def docfx(session):
409421
"""Build the docfx yaml files for this library."""
410-
422+
install_default_packages(session)
411423
session.install("-e", ".[tracing]")
412424
session.install(
413425
# We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -469,6 +481,7 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
469481
session.skip("cpp implementation is not supported in python 3.11+")
470482

471483
# Install all dependencies
484+
install_default_packages(session)
472485
session.install("-e", ".[all, tests, tracing]")
473486
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
474487
session.install(*unit_deps_all)

requirements.in

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
backports.tarfile==1.2.0
2+
build==1.2.2.post1
3+
click==8.1.8
4+
importlib_metadata==8.5.0
5+
importlib_resources==6.4.5
6+
jaraco.classes==3.4.0
7+
jaraco.context==6.0.1
8+
jaraco.functools==4.1.0
9+
keyring==25.5.0
10+
more-itertools==10.5.0
11+
packaging==24.2
12+
pip-tools==7.4.1
13+
pyproject_hooks==1.2.0
14+
zipp==3.21.0

requirements.txt

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# pip-compile --generate-hashes requirements.in
6+
#
7+
backports-tarfile==1.2.0 \
8+
--hash=sha256:77e284d754527b01fb1e6fa8a1afe577858ebe4e9dad8919e34c862cb399bc34 \
9+
--hash=sha256:d75e02c268746e1b8144c278978b6e98e85de6ad16f8e4b0844a154557eca991
10+
# via
11+
# -r requirements.in
12+
# jaraco-context
13+
build==1.2.2.post1 \
14+
--hash=sha256:1d61c0887fa860c01971625baae8bdd338e517b836a2f70dd1f7aa3a6b2fc5b5 \
15+
--hash=sha256:b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7
16+
# via
17+
# -r requirements.in
18+
# pip-tools
19+
click==8.1.8 \
20+
--hash=sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2 \
21+
--hash=sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a
22+
# via
23+
# -r requirements.in
24+
# pip-tools
25+
importlib-metadata==8.5.0 \
26+
--hash=sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b \
27+
--hash=sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7
28+
# via
29+
# -r requirements.in
30+
# keyring
31+
importlib-resources==6.4.5 \
32+
--hash=sha256:980862a1d16c9e147a59603677fa2aa5fd82b87f223b6cb870695bcfce830065 \
33+
--hash=sha256:ac29d5f956f01d5e4bb63102a5a19957f1b9175e45649977264a1416783bb717
34+
# via -r requirements.in
35+
jaraco-classes==3.4.0 \
36+
--hash=sha256:47a024b51d0239c0dd8c8540c6c7f484be3b8fcf0b2d85c13825780d3b3f3acd \
37+
--hash=sha256:f662826b6bed8cace05e7ff873ce0f9283b5c924470fe664fff1c2f00f581790
38+
# via
39+
# -r requirements.in
40+
# keyring
41+
jaraco-context==6.0.1 \
42+
--hash=sha256:9bae4ea555cf0b14938dc0aee7c9f32ed303aa20a3b73e7dc80111628792d1b3 \
43+
--hash=sha256:f797fc481b490edb305122c9181830a3a5b76d84ef6d1aef2fb9b47ab956f9e4
44+
# via
45+
# -r requirements.in
46+
# keyring
47+
jaraco-functools==4.1.0 \
48+
--hash=sha256:70f7e0e2ae076498e212562325e805204fc092d7b4c17e0e86c959e249701a9d \
49+
--hash=sha256:ad159f13428bc4acbf5541ad6dec511f91573b90fba04df61dafa2a1231cf649
50+
# via
51+
# -r requirements.in
52+
# keyring
53+
keyring==25.5.0 \
54+
--hash=sha256:4c753b3ec91717fe713c4edd522d625889d8973a349b0e582622f49766de58e6 \
55+
--hash=sha256:e67f8ac32b04be4714b42fe84ce7dad9c40985b9ca827c592cc303e7c26d9741
56+
# via -r requirements.in
57+
more-itertools==10.5.0 \
58+
--hash=sha256:037b0d3203ce90cca8ab1defbbdac29d5f993fc20131f3664dc8d6acfa872aef \
59+
--hash=sha256:5482bfef7849c25dc3c6dd53a6173ae4795da2a41a80faea6700d9f5846c5da6
60+
# via
61+
# -r requirements.in
62+
# jaraco-classes
63+
# jaraco-functools
64+
packaging==24.2 \
65+
--hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \
66+
--hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f
67+
# via
68+
# -r requirements.in
69+
# build
70+
pip-tools==7.4.1 \
71+
--hash=sha256:4c690e5fbae2f21e87843e89c26191f0d9454f362d8acdbd695716493ec8b3a9 \
72+
--hash=sha256:864826f5073864450e24dbeeb85ce3920cdfb09848a3d69ebf537b521f14bcc9
73+
# via -r requirements.in
74+
pyproject-hooks==1.2.0 \
75+
--hash=sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8 \
76+
--hash=sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913
77+
# via
78+
# -r requirements.in
79+
# build
80+
# pip-tools
81+
wheel==0.45.1 \
82+
--hash=sha256:661e1abd9198507b1409a20c02106d9670b2576e916d58f520316666abca6729 \
83+
--hash=sha256:708e7481cc80179af0e556bbf0cc00b8444c7321e2700b8d8580231d13017248
84+
# via pip-tools
85+
zipp==3.21.0 \
86+
--hash=sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4 \
87+
--hash=sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931
88+
# via
89+
# -r requirements.in
90+
# importlib-metadata
91+
92+
# WARNING: The following packages were not pinned, but pip requires them to be
93+
# pinned when the requirements file includes hashes and the requirement is not
94+
# satisfied by a package already installed. Consider using the --allow-unsafe flag.
95+
# pip
96+
# setuptools

spanner/pyvenv.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
home = /Library/Frameworks/Python.framework/Versions/3.11/bin
2+
include-system-site-packages = false
3+
version = 3.11.6
4+
executable = /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11
5+
command = /usr/local/bin/python3 -m venv /Users/sakthivelmani/Repos/googleapis/python-spanner/spanner

0 commit comments

Comments
 (0)