Skip to content

Commit a77eb59

Browse files
authored
Merge branch 'main' into add-librarian-workflow
2 parents 4135b45 + 60112bb commit a77eb59

16 files changed

Lines changed: 6469 additions & 122 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>

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ public class ConnectionProperties {
271271
static final ConnectionProperty<SpannerOptions.InstanceType> TYPE =
272272
create(
273273
TYPE_PROPERTY_NAME,
274-
"Specifies the type of Spanner instance to connect to (cloud or omni). Setting it to omni is mandatory when connecting to a Spanner Omni instance.",
274+
"Specifies the type of Spanner instance to connect to (cloud or omni). Setting it to omni"
275+
+ " is mandatory when connecting to a Spanner Omni instance.",
275276
DEFAULT_TYPE,
276277
new SpannerOptions.InstanceType[] {
277278
SpannerOptions.InstanceType.CLOUD, SpannerOptions.InstanceType.OMNI,

sdk-platform-java/gapic-generator-java/pom.xml

Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -137,101 +137,8 @@
137137
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/gapic/metadata/gapic_metadata.proto
138138
</url>
139139
<outputDirectory>target/generated-sources/proto</outputDirectory>
140-
</configuration>
141-
</execution>
142-
<execution>
143-
<id>download-common-resources-proto</id>
144-
<phase>generate-test-sources</phase>
145-
<goals>
146-
<goal>wget</goal>
147-
</goals>
148-
<configuration>
149-
<url>
150-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/cloud/common_resources.proto
151-
</url>
152-
<outputDirectory>target/generated-test-sources/proto</outputDirectory>
153-
</configuration>
154-
</execution>
155-
<execution>
156-
<id>download-pubsub-proto</id>
157-
<phase>generate-test-sources</phase>
158-
<goals>
159-
<goal>wget</goal>
160-
</goals>
161-
<configuration>
162-
<url>
163-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/pubsub/v1/pubsub.proto
164-
</url>
165-
<outputDirectory>target/generated-test-sources/proto</outputDirectory>
166-
</configuration>
167-
</execution>
168-
<execution>
169-
<id>download-schema-proto</id>
170-
<phase>generate-test-sources</phase>
171-
<goals>
172-
<goal>wget</goal>
173-
</goals>
174-
<configuration>
175-
<url>
176-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/pubsub/v1/schema.proto
177-
</url>
178-
<outputDirectory>target/generated-test-sources/proto/google/pubsub/v1
179-
</outputDirectory>
180-
</configuration>
181-
</execution>
182-
<execution>
183-
<id>download-logging-proto</id>
184-
<phase>generate-test-sources</phase>
185-
<goals>
186-
<goal>wget</goal>
187-
</goals>
188-
<configuration>
189-
<url>
190-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/logging/v2/logging.proto
191-
</url>
192-
<outputDirectory>target/generated-test-sources/proto</outputDirectory>
193-
</configuration>
194-
</execution>
195-
<execution>
196-
<id>download-log-entry-proto</id>
197-
<phase>generate-test-sources</phase>
198-
<goals>
199-
<goal>wget</goal>
200-
</goals>
201-
<configuration>
202-
<url>
203-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/logging/v2/log_entry.proto
204-
</url>
205-
<outputDirectory>target/generated-test-sources/proto/google/logging/v2
206-
</outputDirectory>
207-
</configuration>
208-
</execution>
209-
<execution>
210-
<id>download-logging-config-proto</id>
211-
<phase>generate-test-sources</phase>
212-
<goals>
213-
<goal>wget</goal>
214-
</goals>
215-
<configuration>
216-
<url>
217-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/logging/v2/logging_config.proto
218-
</url>
219-
<outputDirectory>target/generated-test-sources/proto/google/logging/v2
220-
</outputDirectory>
221-
</configuration>
222-
</execution>
223-
<execution>
224-
<id>download-logging-metrics-proto</id>
225-
<phase>generate-test-sources</phase>
226-
<goals>
227-
<goal>wget</goal>
228-
</goals>
229-
<configuration>
230-
<url>
231-
https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/logging/v2/logging_metrics.proto
232-
</url>
233-
<outputDirectory>target/generated-test-sources/proto/google/logging/v2
234-
</outputDirectory>
140+
<skipCache>true</skipCache>
141+
<overwrite>true</overwrite>
235142
</configuration>
236143
</execution>
237144
</executions>
@@ -279,16 +186,6 @@
279186
<descriptorSetFileName>test-proto.descriptorset</descriptorSetFileName>
280187
</configuration>
281188
</execution>
282-
<execution>
283-
<id>compile-downloaded-test-protos</id>
284-
<goals>
285-
<goal>test-compile</goal>
286-
</goals>
287-
<configuration>
288-
<protoTestSourceRoot>target/generated-test-sources/proto</protoTestSourceRoot>
289-
<clearOutputDirectory>false</clearOutputDirectory>
290-
</configuration>
291-
</execution>
292189
</executions>
293190
</plugin>
294191
<plugin>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2025 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+
// This file contains stub messages for common resources in GCP.
16+
// It is not intended to be directly generated, and is instead used by
17+
// other tooling to be able to match common resource patterns.
18+
syntax = "proto3";
19+
20+
package google.cloud;
21+
22+
import "google/api/resource.proto";
23+
24+
25+
option (google.api.resource_definition) = {
26+
type: "cloudresourcemanager.googleapis.com/Project"
27+
pattern: "projects/{project}"
28+
};
29+
30+
31+
option (google.api.resource_definition) = {
32+
type: "cloudresourcemanager.googleapis.com/Organization"
33+
pattern: "organizations/{organization}"
34+
};
35+
36+
37+
option (google.api.resource_definition) = {
38+
type: "cloudresourcemanager.googleapis.com/Folder"
39+
pattern: "folders/{folder}"
40+
};
41+
42+
43+
option (google.api.resource_definition) = {
44+
type: "cloudbilling.googleapis.com/BillingAccount"
45+
pattern: "billingAccounts/{billing_account}"
46+
};
47+
48+
option (google.api.resource_definition) = {
49+
type: "locations.googleapis.com/Location"
50+
pattern: "projects/{project}/locations/{location}"
51+
};
52+

0 commit comments

Comments
 (0)