Skip to content

Commit 87cfe16

Browse files
committed
Merge branch 'main' into change-streams-txn-exclusion-sample
2 parents fc78608 + 6dfc494 commit 87cfe16

File tree

738 files changed

+81409
-18243
lines changed

Some content is hidden

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

738 files changed

+81409
-18243
lines changed

.github/.OwlBot.yaml renamed to .github/.OwlBot-hermetic.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
docker:
16-
image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest"
17-
1814
deep-remove-regex:
1915
- "/grpc-google-.*/src"
2016
- "/proto-google-.*/src"

.github/.OwlBot.lock.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/release-please.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ branches:
3434
bumpMinorPreMajor: true
3535
handleGHRelease: true
3636
branch: 6.55.x
37+
- releaseType: java-backport
38+
bumpMinorPreMajor: true
39+
handleGHRelease: true
40+
branch: 6.67.x
41+
- releaseType: java-backport
42+
bumpMinorPreMajor: true
43+
handleGHRelease: true
44+
branch: 6.66.x
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/bin/bash
2+
set -e
3+
# This script should be run at the root of the repository.
4+
# This script is used to update googleapis_commitish, gapic_generator_version,
5+
# and libraries_bom_version in generation configuration at the time of running
6+
# and create a pull request.
7+
8+
# The following commands need to be installed before running the script:
9+
# 1. git
10+
# 2. gh
11+
# 3. jq
12+
13+
# Utility functions
14+
# Get the latest released version of a Maven artifact.
15+
function get_latest_released_version() {
16+
local group_id=$1
17+
local artifact_id=$2
18+
latest=$(curl -s "https://search.maven.org/solrsearch/select?q=g:${group_id}+AND+a:${artifact_id}&core=gav&rows=500&wt=json" | jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v' | sort -V | tail -n 1)
19+
echo "${latest}"
20+
}
21+
22+
# Update a key to a new value in the generation config.
23+
function update_config() {
24+
local key_word=$1
25+
local new_value=$2
26+
local file=$3
27+
echo "Update ${key_word} to ${new_value} in ${file}"
28+
sed -i -e "s/^${key_word}.*$/${key_word}: ${new_value}/" "${file}"
29+
}
30+
31+
# The parameters of this script is:
32+
# 1. base_branch, the base branch of the result pull request.
33+
# 2. repo, organization/repo-name, e.g., googleapis/google-cloud-java
34+
# 3. [optional] generation_config, the path to the generation configuration,
35+
# the default value is generation_config.yaml in the repository root.
36+
while [[ $# -gt 0 ]]; do
37+
key="$1"
38+
case "${key}" in
39+
--base_branch)
40+
base_branch="$2"
41+
shift
42+
;;
43+
--repo)
44+
repo="$2"
45+
shift
46+
;;
47+
--generation_config)
48+
generation_config="$2"
49+
shift
50+
;;
51+
*)
52+
echo "Invalid option: [$1]"
53+
exit 1
54+
;;
55+
esac
56+
shift
57+
done
58+
59+
if [ -z "${base_branch}" ]; then
60+
echo "missing required argument --base_branch"
61+
exit 1
62+
fi
63+
64+
if [ -z "${repo}" ]; then
65+
echo "missing required argument --repo"
66+
exit 1
67+
fi
68+
69+
if [ -z "${generation_config}" ]; then
70+
generation_config="generation_config.yaml"
71+
echo "Use default generation config: ${generation_config}"
72+
fi
73+
74+
current_branch="generate-libraries-${base_branch}"
75+
title="chore: Update generation configuration at $(date)"
76+
77+
# try to find a open pull request associated with the branch
78+
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")
79+
# create a branch if there's no open pull request associated with the
80+
# branch; otherwise checkout the pull request.
81+
if [ -z "${pr_num}" ]; then
82+
git checkout -b "${current_branch}"
83+
else
84+
gh pr checkout "${pr_num}"
85+
fi
86+
87+
mkdir tmp-googleapis
88+
# use partial clone because only commit history is needed.
89+
git clone --filter=blob:none https://github.com/googleapis/googleapis.git tmp-googleapis
90+
pushd tmp-googleapis
91+
git pull
92+
latest_commit=$(git rev-parse HEAD)
93+
popd
94+
rm -rf tmp-googleapis
95+
update_config "googleapis_commitish" "${latest_commit}" "${generation_config}"
96+
97+
# update gapic-generator-java version to the latest
98+
latest_version=$(get_latest_released_version "com.google.api" "gapic-generator-java")
99+
update_config "gapic_generator_version" "${latest_version}" "${generation_config}"
100+
101+
# update libraries-bom version to the latest
102+
latest_version=$(get_latest_released_version "com.google.cloud" "libraries-bom")
103+
update_config "libraries_bom_version" "${latest_version}" "${generation_config}"
104+
105+
git add "${generation_config}"
106+
changed_files=$(git diff --cached --name-only)
107+
if [[ "${changed_files}" == "" ]]; then
108+
echo "The latest generation config is not changed."
109+
echo "Skip committing to the pull request."
110+
exit 0
111+
fi
112+
git commit -m "${title}"
113+
if [ -z "${pr_num}" ]; then
114+
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
115+
git fetch -q --unshallow remote_repo
116+
git push -f remote_repo "${current_branch}"
117+
gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}"
118+
else
119+
git push
120+
gh pr edit "${pr_num}" --title "${title}" --body "${title}"
121+
fi

.github/sync-repo-settings.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ branchProtectionRules:
1919
- checkstyle
2020
- compile (8)
2121
- compile (11)
22-
- OwlBot Post Processor
2322
- units-with-multiplexed-session (8)
2423
- units-with-multiplexed-session (11)
2524
- pattern: 3.3.x
@@ -141,7 +140,25 @@ branchProtectionRules:
141140
- checkstyle
142141
- compile (8)
143142
- compile (11)
144-
- OwlBot Post Processor
143+
- pattern: 6.66.x
144+
isAdminEnforced: true
145+
requiredApprovingReviewCount: 1
146+
requiresCodeOwnerReviews: true
147+
requiresStrictStatusChecks: false
148+
requiredStatusCheckContexts:
149+
- dependencies (17)
150+
- lint
151+
- javadoc
152+
- units (8)
153+
- units (11)
154+
- 'Kokoro - Test: Integration'
155+
- 'Kokoro - Test: Integration with Multiplexed Sessions'
156+
- cla/google
157+
- checkstyle
158+
- compile (8)
159+
- compile (11)
160+
- units-with-multiplexed-session (8)
161+
- units-with-multiplexed-session (11)
145162
permissionRules:
146163
- team: yoshi-admins
147164
permission: admin

.github/workflows/approve-readme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
2323
steps:
24-
- uses: actions/github-script@v6
24+
- uses: actions/github-script@v7
2525
with:
2626
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
2727
script: |

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- run: .kokoro/build.sh
5353
env:
5454
JOB_TYPE: test
55-
GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS: true
55+
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true
5656
units-java8:
5757
# Building using Java 17 and run the tests with Java 8 runtime
5858
name: "units (8)"
@@ -91,7 +91,7 @@ jobs:
9191
- run: .kokoro/build.sh
9292
env:
9393
JOB_TYPE: test
94-
GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS: true
94+
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true
9595
windows:
9696
runs-on: windows-latest
9797
steps:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2024 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+
# GitHub action job to test core java library features on
15+
# downstream client libraries before they are released.
16+
name: Hermetic library generation upon generation config change through pull requests
17+
on:
18+
pull_request:
19+
20+
env:
21+
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
22+
GITHUB_REPOSITORY: ${{ github.repository }}
23+
jobs:
24+
library_generation:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Determine whether the pull request comes from a fork
28+
run: |
29+
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
30+
echo "This PR comes from a fork. Skip library generation."
31+
echo "SHOULD_RUN=false" >> $GITHUB_ENV
32+
else
33+
echo "SHOULD_RUN=true" >> $GITHUB_ENV
34+
fi
35+
- uses: actions/checkout@v4
36+
if: env.SHOULD_RUN == 'true'
37+
with:
38+
fetch-depth: 0
39+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
40+
- uses: googleapis/sdk-platform-java/.github/[email protected]
41+
if: env.SHOULD_RUN == 'true'
42+
with:
43+
base_ref: ${{ github.base_ref }}
44+
head_ref: ${{ github.head_ref }}
45+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

.github/workflows/integration-tests-against-emulator-with-multiplexed-session.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ jobs:
3939
env:
4040
JOB_TYPE: test
4141
SPANNER_EMULATOR_HOST: localhost:9010
42-
GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS: true
42+
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true

.github/workflows/renovate_config_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Set up Node.js
17-
uses: actions/setup-node@v3
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: '20'
2020

.github/workflows/unmanaged_dependency_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
# repository
1818
.kokoro/build.sh
1919
- name: Unmanaged dependency check
20-
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.30.0
20+
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.37.0
2121
with:
2222
bom-path: google-cloud-spanner-bom/pom.xml
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2024 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+
# GitHub action job to test core java library features on
15+
# downstream client libraries before they are released.
16+
name: Update generation configuration
17+
on:
18+
schedule:
19+
- cron: '0 2 * * *'
20+
workflow_dispatch:
21+
22+
jobs:
23+
update-generation-config:
24+
runs-on: ubuntu-24.04
25+
env:
26+
# the branch into which the pull request is merged
27+
base_branch: main
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
32+
- name: Update params in generation config to latest
33+
shell: bash
34+
run: |
35+
set -x
36+
[ -z "$(git config user.email)" ] && git config --global user.email "[email protected]"
37+
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
38+
bash .github/scripts/update_generation_config.sh \
39+
--base_branch "${base_branch}"\
40+
--repo ${{ github.repository }}
41+
env:
42+
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

.kokoro/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTI
4848
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS})
4949
fi
5050

51+
# Start the Spanner emulator if the environment variable for it has been set.
52+
# TODO: Change if statement once the env var can be set in the config.
53+
#if [[ ! -z "${SPANNER_EMULATOR_HOST}" ]]; then
54+
if [[ "$JOB_TYPE" == "graalvm" ]] || [[ "$JOB_TYPE" == "graalvm17" ]]; then
55+
echo "Starting emulator"
56+
export SPANNER_EMULATOR_HOST=localhost:9010
57+
docker pull gcr.io/cloud-spanner-emulator/emulator
58+
docker run -d --rm --name spanner-emulator -p 9010:9010 -p 9020:9020 gcr.io/cloud-spanner-emulator/emulator
59+
fi
60+
5161
# Kokoro integration test uses both JDK 11 and JDK 8. We ensure the generated class files
5262
# are compatible with Java 8 when running tests.
5363
if [ -n "${JAVA8_HOME}" ]; then
@@ -233,6 +243,11 @@ clirr)
233243
;;
234244
esac
235245

246+
if [[ ! -z "${SPANNER_EMULATOR_HOST}" ]]; then
247+
echo "Stopping emulator"
248+
docker container stop spanner-emulator
249+
fi
250+
236251
if [ "${REPORT_COVERAGE}" == "true" ]
237252
then
238253
bash ${KOKORO_GFILE_DIR}/codecov.sh

.kokoro/presubmit/graalvm-native-17.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.30.0"
6+
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.37.0"
77
}
88

99
env_vars: {

.kokoro/presubmit/graalvm-native.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.30.0"
6+
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.37.0"
77
}
88

99
env_vars: {

.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ env_vars: {
3333
}
3434

3535
env_vars: {
36-
key: "GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS"
36+
key: "GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS"
3737
value: "true"
38-
}
38+
}

0 commit comments

Comments
 (0)