Skip to content

Commit 7d83b1c

Browse files
Merge branch 'googleapis:main' into feature/cert-rotation-streaming
2 parents cab959c + bb37b8f commit 7d83b1c

2,500 files changed

Lines changed: 1777879 additions & 5751 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/unittest.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ jobs:
6969
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
7070
with:
7171
python-version: "3.10"
72-
- name: Set number of files changes in packages directory
72+
- name: Set number of files changes in packages and preview-packages directories
7373
id: packages
7474
run: |
75-
git diff HEAD~1 -- packages > /dev/null
76-
num_files_changed=$(git diff HEAD~1 -- packages | wc -l | tr -d ' ')
75+
git diff HEAD~1 -- packages preview-packages > /dev/null
76+
num_files_changed=$(git diff HEAD~1 -- packages preview-packages | wc -l | tr -d ' ')
7777
echo "num_files_changed=${num_files_changed}" >> "$GITHUB_OUTPUT"
7878
- name: Install coverage
7979
if: ${{ steps.packages.outputs.num_files_changed > 0 }}
@@ -107,7 +107,7 @@ jobs:
107107
fi
108108
109109
# Find all modified packages
110-
modified_packages=$(git diff --name-only HEAD~1 -- packages | cut -d/ -f1,2 | sort -u)
110+
modified_packages=$(git diff --name-only HEAD~1 -- packages preview-packages | cut -d/ -f1,2 | sort -u)
111111
112112
failed_packages=()
113113
passed_packages=()

.kokoro/system.sh

Lines changed: 144 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,39 @@ RETVAL=0
3535

3636
pwd
3737

38+
echo "=== KOKORO VM SCOUTING ==="
39+
echo "CPU Count:"
40+
nproc
41+
echo "--------------------------"
42+
echo "Detailed CPU Info:"
43+
lscpu | grep -E "^(Model name|CPU\(s\)|Thread\(s\) per core|Core\(s\) per socket)"
44+
echo "--------------------------"
45+
echo "Memory Status:"
46+
free -h
47+
echo "--------------------------"
48+
echo "Disk Usage:"
49+
df -h /
50+
echo "=========================="
51+
3852
run_package_test() {
3953
local package_name=$1
4054
local package_path="packages/${package_name}"
41-
55+
4256
# Declare local overrides to prevent bleeding into the next loop iteration
4357
local PROJECT_ID
4458
local GOOGLE_APPLICATION_CREDENTIALS
4559
local NOX_FILE
4660
# Inherit NOX_SESSION from environment to allow configs (like prerelease.cfg) to pass it in
4761
local NOX_SESSION="${NOX_SESSION}"
4862

63+
# ISOLATION: Create a unique gcloud config dir for this run
64+
local gcloud_config_dir=$(mktemp -d -t "gcloud-config-${package_name}-XXXXXX")
65+
local CLOUDSDK_CONFIG="${gcloud_config_dir}"
66+
67+
# 🪤 TRAP: Ensure cleanup of THIS specific temp dir on exit of this subshell
68+
trap 'rm -rf "$gcloud_config_dir"' EXIT
69+
70+
4971
echo "------------------------------------------------------------"
5072
echo "Configuring environment for: ${package_name}"
5173
echo "------------------------------------------------------------"
@@ -80,11 +102,13 @@ run_package_test() {
80102
esac
81103

82104
# Export variables for the duration of this function's sub-processes
83-
export PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS NOX_FILE NOX_SESSION
105+
export PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS NOX_FILE NOX_SESSION CLOUDSDK_CONFIG
84106
export GOOGLE_CLOUD_PROJECT="${PROJECT_ID}"
85107

86-
gcloud auth activate-service-account --key-file="$GOOGLE_APPLICATION_CREDENTIALS"
87-
gcloud config set project "$PROJECT_ID"
108+
# 🛡️ Explicit check: Fail early if auth fails
109+
gcloud auth activate-service-account --key-file="$GOOGLE_APPLICATION_CREDENTIALS" || return 1
110+
export CLOUDSDK_CORE_PROJECT="${PROJECT_ID}"
111+
88112

89113
# Run the actual test
90114
pushd "${package_path}" > /dev/null
@@ -93,13 +117,81 @@ run_package_test() {
93117
local res=$?
94118
set -e
95119
popd > /dev/null
96-
120+
97121
return $res
98122
}
99123

124+
# Analyzes results of parallel test runs, prints summary, and dumps failed logs
125+
reap_parallel_results() {
126+
local retval=0
127+
local failed_count=0
128+
local passed_count=0
129+
130+
if [ -z "$LOG_DIR" ]; then
131+
echo "Error: LOG_DIR is not set."
132+
return 1
133+
fi
134+
135+
# Count failed packages by checking for .failed marker files
136+
for failed in "$LOG_DIR"/*.failed; do
137+
if [ -f "$failed" ]; then
138+
failed_count=$((failed_count + 1))
139+
fi
140+
done
141+
142+
local total_tested=${#PACKAGES_TO_TEST[@]}
143+
passed_count=$((total_tested - failed_count))
144+
145+
echo ""
146+
echo "=================================================="
147+
echo " TEST RUN SUMMARY "
148+
echo "=================================================="
149+
echo "Total tested: $total_tested"
150+
echo "Passed: $passed_count"
151+
echo "Failed: $failed_count"
152+
echo "=================================================="
153+
154+
local passed_packages=()
155+
for pkg in "${PACKAGES_TO_TEST[@]}"; do
156+
if [ ! -f "$LOG_DIR/$pkg.failed" ]; then
157+
passed_packages+=("$pkg")
158+
fi
159+
done
160+
161+
if [ ${#passed_packages[@]} -gt 0 ]; then
162+
echo ""
163+
echo "PASSED PACKAGES:"
164+
printf "%s\n" "${passed_packages[@]}" | sort | sed 's/^/- /'
165+
fi
166+
167+
if [ "$failed_count" -gt 0 ]; then
168+
echo ""
169+
echo "!!! DETAILED LOGS FOR FAILED PACKAGES !!!"
170+
for failed in "$LOG_DIR"/*.failed; do
171+
if [ -f "$failed" ]; then
172+
local pkg=$(basename "$failed" .failed)
173+
echo "--------------------------------------------------"
174+
echo "LOGS FOR: $pkg"
175+
echo "--------------------------------------------------"
176+
if [ -n "$KOKORO_ARTIFACTS_DIR" ] && [ -f "$KOKORO_ARTIFACTS_DIR/$pkg/sponge_log.log" ]; then
177+
cat "$KOKORO_ARTIFACTS_DIR/$pkg/sponge_log.log"
178+
else
179+
cat "$LOG_DIR/$pkg.log"
180+
fi
181+
echo ""
182+
fi
183+
done
184+
retval=1
185+
fi
186+
return $retval
187+
}
188+
189+
100190
# A file for running system tests
101191
system_test_script="${PROJECT_ROOT}/.kokoro/system-single.sh"
102192

193+
PACKAGES_TO_TEST=()
194+
103195
# Run system tests for each package with directory packages/*/tests/system
104196
for path in `find 'packages' \
105197
\( -type d -wholename 'packages/*/tests/system' \) -o \
@@ -113,6 +205,7 @@ for path in `find 'packages' \
113205
package_name=${package_name%%/*}
114206
package_path="packages/${package_name}"
115207

208+
116209
# Determine if we should skip based on git diff
117210
# We always check for changes in these specific versioning/config files
118211
files_to_check=(
@@ -147,10 +240,54 @@ for path in `find 'packages' \
147240
set -e
148241

149242
if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then
150-
# Call the function - its internal exports won't affect the next loop
151-
run_package_test "$package_name" || RETVAL=$?
243+
PACKAGES_TO_TEST+=("$package_name")
152244
else
153245
echo "No changes in ${package_name} and not a continuous build, skipping."
154246
fi
155247
done
248+
249+
# Parallel Execution Logic
250+
MAX_JOBS=${MAX_JOBS:-4}
251+
252+
# Temporary directory for clean log segregation
253+
LOG_DIR=$(mktemp -d -t test-logs-XXXXXX)
254+
# Clean up logs on exit
255+
trap 'rm -rf "$LOG_DIR"' EXIT
256+
257+
if [ ${#PACKAGES_TO_TEST[@]} -eq 0 ]; then
258+
echo "No packages to test."
259+
exit 0
260+
fi
261+
262+
echo "=================================================="
263+
echo "Starting parallel test execution for ${#PACKAGES_TO_TEST[@]} packages"
264+
echo "Concurrency limit: ${MAX_JOBS}"
265+
echo "=================================================="
266+
267+
export LOG_DIR
268+
export -f run_package_test
269+
export system_test_script PROJECT_ROOT KOKORO_GFILE_DIR
270+
271+
# Stream package names to xargs for parallel execution
272+
# -P "$MAX_JOBS" controls concurrency
273+
# -I {} replaces {} with the package name
274+
printf '%s\n' "${PACKAGES_TO_TEST[@]}" \
275+
| xargs -P "$MAX_JOBS" -I {} \
276+
bash -c '
277+
pkg="$1"
278+
# Determine log location: prefer Sponge artifacts directory if available
279+
if [ -n "$KOKORO_ARTIFACTS_DIR" ]; then
280+
pkg_log_dir="$KOKORO_ARTIFACTS_DIR/$pkg"
281+
mkdir -p "$pkg_log_dir" || { touch "$LOG_DIR/$pkg.failed"; exit 1; }
282+
log_file="$pkg_log_dir/sponge_log.log"
283+
else
284+
log_file="$LOG_DIR/$pkg.log"
285+
fi
286+
287+
# Run test; if it fails, create a .failed file to signal failure to the reaper
288+
run_package_test "$pkg" > "$log_file" 2>&1 || touch "$LOG_DIR/$pkg.failed"
289+
' _ "{}"
290+
291+
reap_parallel_results || RETVAL=1
292+
156293
exit ${RETVAL}

.librarian/generator-input/client-post-processing/bigtable-integration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ replacements:
200200
"protobuf >= 6.33.5, < 8.0.0",
201201
"google-cloud-core >= 2.0.0, <3.0.0",
202202
"grpc-google-iam-v1 >= 0.14.2, <1.0.0",
203-
"google-crc32c>=1.6.0, <2.0.0dev",
203+
"google-crc32c>=1.6.0, < 2.0.0",
204204
]
205205
count: 1
206206
- paths: [

.librarian/generator-input/client-post-processing/pubsub-integration.yaml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ replacements:
374374
- "packages/google-cloud-pubsub/setup.py"
375375
before: '([ \t]+)("grpc-google-iam-v1.*",\n)\]\nextras = \{\}'
376376
after: |-
377-
\g<1>\g<2>\g<1>"grpcio-status >= 1.51.3",
377+
\g<1>\g<2>\g<1>"grpcio-status >= 1.59.0, < 2.0.0",
378+
\g<1>"grpcio-status >= 1.75.1, < 2.0.0; python_version >= '3.14'",
378379
\g<1>"opentelemetry-api >= 1.27.0",
379380
\g<1>"opentelemetry-sdk >= 1.27.0",
380381
]
@@ -519,21 +520,7 @@ replacements:
519520
before: 'grpc-google-iam-v1==0\.14\.2\n(?!grpcio-status)'
520521
after: |-
521522
grpc-google-iam-v1==0.14.2
522-
grpcio-status==1.51.3
523+
grpcio-status==1.59.0
523524
opentelemetry-api==1.27.0
524525
opentelemetry-sdk==1.27.0
525526
count: 1
526-
527-
- paths:
528-
- "packages/google-cloud-pubsub/testing/constraints-3.10.txt"
529-
before: 'grpcio==1.59.0'
530-
after: 'grpcio==1.51.3'
531-
count: 1
532-
533-
- paths:
534-
- "packages/google-cloud-pubsub/setup.py"
535-
before: '([ \t]+)"grpcio >= [0-9\.]+, < 2\.0\.0",\n(?:[ \t]*)"grpcio >= 1\.75\.1, < 2\.0\.0; python_version >= ''3\.14''",\n'
536-
after: |-
537-
\g<1>"grpcio >= 1.51.3, < 2.0.0; python_version < '3.14'",
538-
\g<1>"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
539-
count: 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
description: Remove unused imports
15+
url: https://github.com/googleapis/gapic-generator-python/issues/1833
16+
replacements:
17+
- paths: [
18+
packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py
19+
]
20+
before: |
21+
import google.cloud.gkehub.configmanagement.v1.configmanagement_pb2 as configmanagement_pb2 # type: ignore
22+
import google.cloud.gkehub.multiclusteringress.v1.multiclusteringress_pb2 as multiclusteringress_pb2 # type: ignore
23+
import google.cloud.gkehub.rbacrolebindingactuation.v1.rbacrolebindingactuation_pb2 as rbacrolebindingactuation_pb2 # type: ignore
24+
after: ""
25+
count: 1
26+
- paths: [
27+
packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py
28+
]
29+
before: |
30+
import grafeas.v1.attestation_pb2 as attestation_pb2 # type: ignore
31+
import grafeas.v1.common_pb2 as common_pb2 # type: ignore
32+
after: ""
33+
count: 1

.librarian/generator-input/client-post-processing/spanner-integration.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ replacements:
165165
# See https://github.com/googleapis/google-cloud-python/issues/12364
166166
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
167167
"google-cloud-core >= 2.0.0, < 3.0.0",
168-
"grpcio >= 1.49.1, < 2.0.0",
168+
"grpcio >= 1.59.0, < 2.0.0",
169169
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
170170
"grpc-google-iam-v1 >= 0.14.2, <1.0.0",
171171
"proto-plus >= 1.26.1, <2.0.0",
@@ -1397,6 +1397,7 @@ replacements:
13971397
protobuf==6.33.5
13981398
google-cloud-core==2.0.0
13991399
grpc-google-iam-v1==0.14.2
1400+
grpcio-status==1.59.0
14001401
sqlparse==0.4.4
14011402
grpc-interceptor==0.15.4
14021403
opentelemetry-api==1.22.0
@@ -1427,12 +1428,6 @@ replacements:
14271428
"auto",
14281429
"tests/unit",
14291430
count: 1
1430-
- paths: [packages/google-cloud-spanner/testing/constraints-3.10.txt]
1431-
before: 'grpcio==1.59.0\n(?!grpcio-status)'
1432-
after: |
1433-
grpcio==1.49.1
1434-
grpcio-status==1.49.1
1435-
count: 1
14361431
- paths: [packages/google-cloud-spanner/.coveragerc]
14371432
before: |
14381433
\[report\]

.librarian/generator-input/client-post-processing/storage-integration.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ replacements:
597597
# experimental in this SDK. More info in b/465352227
598598
"grpc": [
599599
"google-api-core[grpc] >= 2.27.0, < 3.0.0",
600-
"grpcio >= 1.59.0, < 2.0.0; python_version < '3.14'",
600+
"grpcio >= 1.59.0, < 2.0.0",
601601
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
602-
"grpcio-status >= 1.59.0, < 2.0.0; python_version < '3.14'",
602+
"grpcio-status >= 1.59.0, < 2.0.0",
603603
"grpcio-status >= 1.75.1, < 2.0.0; python_version >= '3.14'",
604604
"proto-plus >= 1.22.3, <2.0.0; python_version < '3.13'",
605605
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
description: Temporary post processing until https://github.com/googleapis/google-cloud-python/pull/17914 is released
15+
url: https://github.com/googleapis/google-cloud-python/pull/17914
16+
replacements:
17+
- paths: [
18+
"packages/google-cloud-ces/google/cloud/ces_v1/services/session_service/async_client.py",
19+
"packages/google-cloud-ces/google/cloud/ces_v1/services/session_service/client.py",
20+
"packages/google-cloud-ces/google/cloud/ces_v1beta/services/session_service/async_client.py",
21+
"packages/google-cloud-ces/google/cloud/ces_v1beta/services/session_service/client.py",
22+
]
23+
before: |
24+
header_params = \{\}
25+
after: |
26+
header_params: dict[str, str] = {}
27+
count: 4

ci/run_conditional_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ set -e
8080

8181
subdirs=(
8282
packages
83+
preview-packages
8384
)
8485

8586
RETVAL=0

0 commit comments

Comments
 (0)