Skip to content

Commit 67b84ef

Browse files
Merge branch 'main' into jdbc/feature-branch-otel
2 parents 8bc5ce1 + 056abb6 commit 67b84ef

24 files changed

Lines changed: 7094 additions & 178 deletions

File tree

.github/CODEOWNERS

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
# For syntax help see:
44
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
55

6-
* @googleapis/cloud-sdk-java-team
6+
* @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
77

88
# java-vertexai has maintainers
9-
/java-vertexai/ @googleapis/vertexai-team @googleapis/cloud-sdk-java-team
10-
/java-bigquerystorage/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team
11-
/java-bigquery/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team
12-
/java-bigquery-jdbc/ @googleapis/bigquery-developer-tools-team @googleapis/bigquery-team @googleapis/cloud-sdk-java-team
13-
/grpc-gcp-java/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team
14-
/java-spanner/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team
15-
/java-spanner-jdbc/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team
16-
/google-auth-library-java/ @googleapis/cloud-sdk-auth-team @googleapis/cloud-sdk-java-team @googleapis/aion-team
17-
/java-storage/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team
18-
/java-storage-nio/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team
19-
/java-pubsub/ @googleapis/pubsub-team @googleapis/cloud-sdk-java-team
20-
/java-bigtable/ @googleapis/bigtable-team @googleapis/cloud-sdk-java-team
21-
/java-firestore/ @googleapis/firestore-team @googleapis/cloud-sdk-java-team
9+
/java-vertexai/ @googleapis/vertexai-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
10+
/java-bigquerystorage/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
11+
/java-bigquery/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
12+
/java-bigquery-jdbc/ @googleapis/bigquery-developer-tools-team @googleapis/bigquery-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
13+
/grpc-gcp-java/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
14+
/java-spanner/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
15+
/java-spanner-jdbc/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
16+
/google-auth-library-java/ @googleapis/cloud-sdk-auth-team @googleapis/cloud-sdk-java-team @googleapis/aion-team @googleapis/cloud-sdk-librarian-team
17+
/java-storage/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
18+
/java-storage-nio/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
19+
/java-pubsub/ @googleapis/pubsub-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
20+
/java-bigtable/ @googleapis/bigtable-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
21+
/java-firestore/ @googleapis/firestore-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
2222
/librarian.yaml @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
15+
name: Update librarian googleapis commitish
16+
on:
17+
schedule:
18+
- cron: '0 3 * * *' # Run once a day at 3:00 AM UTC
19+
workflow_dispatch: # Allow manual trigger
20+
pull_request: # Run in dry-run mode to test changes to this workflow itself
21+
paths:
22+
- '.github/workflows/update_librarian_googleapis.yaml'
23+
jobs:
24+
update-librarian-googleapis:
25+
runs-on: ubuntu-24.04
26+
defaults:
27+
run:
28+
working-directory: google-cloud-java
29+
steps:
30+
- name: Checkout google-cloud-java
31+
uses: actions/checkout@v6
32+
with:
33+
repository: googleapis/google-cloud-java
34+
path: google-cloud-java
35+
fetch-depth: 0
36+
- name: Check for Open PR
37+
env:
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
run: |
40+
set -x
41+
current_branch="update-librarian-googleapis-main"
42+
43+
if [ "${{ github.event_name }}" = "pull_request" ]; then
44+
echo "PR Test: Skipping open PR check."
45+
else
46+
# Try to find an open pull request associated with the branch
47+
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")
48+
49+
if [ -n "${pr_num}" ]; then
50+
echo "Error: An open Pull Request already exists for this update: PR #${pr_num}."
51+
echo "Please merge or close the existing PR before running this workflow again."
52+
exit 1 # Fails this step and the workflow
53+
fi
54+
fi
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version: '>=1.20.2'
59+
- name: Run librarian update
60+
run: |
61+
version=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)
62+
go run "github.com/googleapis/librarian/cmd/librarian@${version}" update sources.googleapis
63+
- name: Get latest commit
64+
id: commit
65+
run: |
66+
version=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)
67+
new_commit=$(go run "github.com/googleapis/librarian/cmd/librarian@${version}" config get sources.googleapis.commit)
68+
echo "new_commit=${new_commit}" >> $GITHUB_OUTPUT
69+
echo "short_commit=${new_commit:0:7}" >> $GITHUB_OUTPUT
70+
- name: Detect Changes
71+
id: detect
72+
run: |
73+
git add librarian.yaml
74+
changed_files=$(git diff --cached --name-only)
75+
if [[ "${changed_files}" == "" ]]; then
76+
echo "has_changes=false" >> $GITHUB_OUTPUT
77+
echo "No changes in librarian.yaml"
78+
else
79+
echo "has_changes=true" >> $GITHUB_OUTPUT
80+
fi
81+
- name: Commit and Create PR
82+
if: steps.detect.outputs.has_changes == 'true'
83+
env:
84+
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
85+
PR_TITLE: "chore: update googleapis commitish to ${{ steps.commit.outputs.short_commit }}"
86+
PR_BODY: "Updated googleapis commitish in librarian.yaml to https://github.com/googleapis/googleapis/commit/${{ steps.commit.outputs.new_commit }}"
87+
run: |
88+
set -x
89+
90+
if [ "${{ github.event_name }}" = "pull_request" ]; then
91+
echo "=== PR Test: DRY RUN MODE ACTIVE ==="
92+
echo "Would have checked out branch: update-librarian-googleapis-main"
93+
echo "Would have committed with title: $PR_TITLE"
94+
echo "Would have pushed branch and created PR."
95+
exit 0
96+
fi
97+
98+
[ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com"
99+
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
100+
101+
base_branch="main"
102+
current_branch="update-librarian-googleapis-${base_branch}"
103+
104+
# Create and switch to the branch (force checkout -B to discard any local state on this branch name if it existed)
105+
git checkout -B "${current_branch}"
106+
107+
# Commit the changes (they are already staged by the Detect Changes step!)
108+
git commit -m "${PR_TITLE}"
109+
110+
# Push to remote (force push to overwrite any stale branch on remote)
111+
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${{ github.repository }}.git" || git remote set-url remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${{ github.repository }}.git"
112+
git fetch -q remote_repo
113+
git push -f remote_repo "${current_branch}"
114+
115+
# Create the PR
116+
gh pr create --title "${PR_TITLE}" --head "${current_branch}" --body "${PR_BODY}" --base "${base_branch}"

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,10 @@ public Job create(JobInfo jobInfo, JobOption... options) {
416416
new Supplier<JobId>() {
417417
@Override
418418
public JobId get() {
419-
return JobId.of();
419+
// Explicitly set the location for a new job when provided in options.
420+
// Otherwise, the job may be created with an incorrect location
421+
// (e.g. in transaction mode outside the US).
422+
return JobId.of().setLocation(getOptions().getLocation());
420423
}
421424
};
422425
return create(jobInfo, idProvider, options);

java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpcTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ public void testCreateJobTelemetry() throws Exception {
795795
"{\"kind\":\"bigquery#job\",\"id\":\""
796796
+ PROJECT_ID
797797
+ ":"
798+
+ LOCATION
799+
+ ":"
798800
+ JOB_ID
799801
+ "\",\"status\":{\"state\":\"DONE\"}}");
800802

@@ -804,7 +806,7 @@ public void testCreateJobTelemetry() throws Exception {
804806

805807
verifyRequest("POST", "/projects/" + PROJECT_ID + "/jobs");
806808
Map<String, String> attributes = new HashMap<>();
807-
attributes.put("bq.rpc.response.job.id", PROJECT_ID + ":" + JOB_ID);
809+
attributes.put("bq.rpc.response.job.id", PROJECT_ID + ":" + LOCATION + ":" + JOB_ID);
808810
attributes.put("bq.rpc.response.job.status.state", "DONE");
809811
verifySpan(
810812
"com.google.cloud.bigquery.BigQueryRpc.createJob",

java-showcase/gapic-showcase/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
https://raw.githubusercontent.com/googleapis/gapic-showcase/v${gapic-showcase.version}/server/services/compliance_suite.json
6969
</url>
7070
<outputDirectory>src/test/resources</outputDirectory>
71+
<skipCache>true</skipCache>
7172
<!-- Set this to always download the latest version and overwrite the existing file -->
7273
<overwrite>true</overwrite>
7374
</configuration>

0 commit comments

Comments
 (0)