Skip to content

Commit 41f83dc

Browse files
cloud-java-botrahul2393JoeWang1127
authored
chore: Update generation configuration at Fri Dec 13 16:21:35 UTC 2024 (#3523)
* chore: Update generation configuration at Wed Dec 4 02:29:01 UTC 2024 * chore: Update generation configuration at Thu Dec 5 02:29:11 UTC 2024 * chore: Update generation configuration at Fri Dec 6 02:28:46 UTC 2024 * chore: generate libraries at Fri Dec 6 02:29:25 UTC 2024 * chore: Update generation configuration at Sat Dec 7 02:28:09 UTC 2024 * chore: Update generation configuration at Tue Dec 10 02:29:37 UTC 2024 * chore: Update generation configuration at Wed Dec 11 02:28:47 UTC 2024 * chore: Update generation configuration at Thu Dec 12 02:29:08 UTC 2024 * chore: generate libraries at Thu Dec 12 02:29:50 UTC 2024 * chore: Update generation configuration at Fri Dec 13 02:29:25 UTC 2024 * chore: Update generation configuration at Fri Dec 13 16:21:35 UTC 2024 * chore: generate libraries at Fri Dec 13 16:22:12 UTC 2024 * update workflow script --------- Co-authored-by: rahul2393 <[email protected]> Co-authored-by: Joe Wang <[email protected]>
1 parent c2d5614 commit 41f83dc

File tree

7 files changed

+97
-39
lines changed

7 files changed

+97
-39
lines changed

.github/scripts/update_generation_config.sh

+55-8
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@ function update_config() {
2828
sed -i -e "s/^${key_word}.*$/${key_word}: ${new_value}/" "${file}"
2929
}
3030

31+
# Update an action to a new version in GitHub action.
32+
function update_action() {
33+
local key_word=$1
34+
local new_value=$2
35+
local file=$3
36+
echo "Update ${key_word} to ${new_value} in ${file}"
37+
# use a different delimiter because the key_word contains "/".
38+
sed -i -e "s|${key_word}@v.*$|${key_word}@v${new_value}|" "${file}"
39+
}
40+
3141
# The parameters of this script is:
3242
# 1. base_branch, the base branch of the result pull request.
3343
# 2. repo, organization/repo-name, e.g., googleapis/google-cloud-java
3444
# 3. [optional] generation_config, the path to the generation configuration,
3545
# the default value is generation_config.yaml in the repository root.
46+
# 4. [optional] workflow, the library generation workflow file,
47+
# the default value is .github/workflows/hermetic_library_generation.yaml.
3648
while [[ $# -gt 0 ]]; do
3749
key="$1"
3850
case "${key}" in
@@ -48,6 +60,10 @@ case "${key}" in
4860
generation_config="$2"
4961
shift
5062
;;
63+
--workflow)
64+
workflow="$2"
65+
shift
66+
;;
5167
*)
5268
echo "Invalid option: [$1]"
5369
exit 1
@@ -71,21 +87,34 @@ if [ -z "${generation_config}" ]; then
7187
echo "Use default generation config: ${generation_config}"
7288
fi
7389

90+
if [ -z "${workflow}" ]; then
91+
workflow=".github/workflows/hermetic_library_generation.yaml"
92+
echo "Use default library generation workflow file: ${workflow}"
93+
fi
94+
7495
current_branch="generate-libraries-${base_branch}"
7596
title="chore: Update generation configuration at $(date)"
7697

77-
# try to find a open pull request associated with the branch
98+
git checkout "${base_branch}"
99+
# Try to find a open pull request associated with the branch
78100
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
101+
# Create a branch if there's no open pull request associated with the
80102
# branch; otherwise checkout the pull request.
81103
if [ -z "${pr_num}" ]; then
82104
git checkout -b "${current_branch}"
105+
# Push the current branch to remote so that we can
106+
# compare the commits later.
107+
git push -u origin "${current_branch}"
83108
else
84109
gh pr checkout "${pr_num}"
85110
fi
86111

112+
# Only allow fast-forward merging; exit with non-zero result if there's merging
113+
# conflict.
114+
git merge -m "chore: merge ${base_branch} into ${current_branch}" "${base_branch}"
115+
87116
mkdir tmp-googleapis
88-
# use partial clone because only commit history is needed.
117+
# Use partial clone because only commit history is needed.
89118
git clone --filter=blob:none https://github.com/googleapis/googleapis.git tmp-googleapis
90119
pushd tmp-googleapis
91120
git pull
@@ -94,25 +123,43 @@ popd
94123
rm -rf tmp-googleapis
95124
update_config "googleapis_commitish" "${latest_commit}" "${generation_config}"
96125

97-
# update gapic-generator-java version to the latest
126+
# Update gapic-generator-java version to the latest
98127
latest_version=$(get_latest_released_version "com.google.api" "gapic-generator-java")
99128
update_config "gapic_generator_version" "${latest_version}" "${generation_config}"
100129

101-
# update libraries-bom version to the latest
130+
# Update composite action version to latest gapic-generator-java version
131+
update_action "googleapis/sdk-platform-java/.github/scripts" \
132+
"${latest_version}" \
133+
"${workflow}"
134+
135+
# Update libraries-bom version to the latest
102136
latest_version=$(get_latest_released_version "com.google.cloud" "libraries-bom")
103137
update_config "libraries_bom_version" "${latest_version}" "${generation_config}"
104138

105-
git add "${generation_config}"
139+
git add "${generation_config}" "${workflow}"
106140
changed_files=$(git diff --cached --name-only)
107141
if [[ "${changed_files}" == "" ]]; then
108142
echo "The latest generation config is not changed."
109143
echo "Skip committing to the pull request."
144+
else
145+
git commit -m "${title}"
146+
fi
147+
148+
# There are potentially at most two commits: merge commit and change commit.
149+
# We want to exit the script if no commit happens (otherwise this will be an
150+
# infinite loop).
151+
# `git cherry` is a way to find whether the local branch has commits that are
152+
# not in the remote branch.
153+
# If we find any such commit, push them to remote branch.
154+
unpushed_commit=$(git cherry -v "origin/${current_branch}" | wc -l)
155+
if [[ "${unpushed_commit}" -eq 0 ]]; then
156+
echo "No unpushed commits, exit"
110157
exit 0
111158
fi
112-
git commit -m "${title}"
159+
113160
if [ -z "${pr_num}" ]; then
114161
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
115-
git fetch -q --unshallow remote_repo
162+
git fetch -q remote_repo
116163
git push -f remote_repo "${current_branch}"
117164
gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}"
118165
else

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you are using Maven without the BOM, add this to your dependencies:
4949
If you are using Gradle 5.x or later, add this to your dependencies:
5050

5151
```Groovy
52-
implementation platform('com.google.cloud:libraries-bom:26.50.0')
52+
implementation platform('com.google.cloud:libraries-bom:26.51.0')
5353
5454
implementation 'com.google.cloud:google-cloud-spanner'
5555
```

generation_config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
gapic_generator_version: 2.50.0
2-
googleapis_commitish: 349841abac6c3e580ccce6e3d6fcc182ed2512c2
3-
libraries_bom_version: 26.50.0
1+
gapic_generator_version: 2.51.0
2+
googleapis_commitish: 7d0c6bee2517d77635beb2a1dd6d6e7d4d943512
3+
libraries_bom_version: 26.51.0
44
libraries:
55
- api_shortname: spanner
66
name_pretty: Cloud Spanner

proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java

+24
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,17 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum {
228228
* <code>INTERVAL = 16;</code>
229229
*/
230230
INTERVAL(16),
231+
/**
232+
*
233+
*
234+
* <pre>
235+
* Encoded as `string`, in lower-case hexa-decimal format, as described
236+
* in RFC 9562, section 4.
237+
* </pre>
238+
*
239+
* <code>UUID = 17;</code>
240+
*/
241+
UUID(17),
231242
UNRECOGNIZED(-1),
232243
;
233244

@@ -424,6 +435,17 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum {
424435
* <code>INTERVAL = 16;</code>
425436
*/
426437
public static final int INTERVAL_VALUE = 16;
438+
/**
439+
*
440+
*
441+
* <pre>
442+
* Encoded as `string`, in lower-case hexa-decimal format, as described
443+
* in RFC 9562, section 4.
444+
* </pre>
445+
*
446+
* <code>UUID = 17;</code>
447+
*/
448+
public static final int UUID_VALUE = 17;
427449

428450
public final int getNumber() {
429451
if (this == UNRECOGNIZED) {
@@ -481,6 +503,8 @@ public static TypeCode forNumber(int value) {
481503
return ENUM;
482504
case 16:
483505
return INTERVAL;
506+
case 17:
507+
return UUID;
484508
default:
485509
return null;
486510
}

proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
6060
+ "pe_fqn\030\005 \001(\t\"\177\n\nStructType\0223\n\006fields\030\001 \003"
6161
+ "(\0132#.google.spanner.v1.StructType.Field\032"
6262
+ "<\n\005Field\022\014\n\004name\030\001 \001(\t\022%\n\004type\030\002 \001(\0132\027.g"
63-
+ "oogle.spanner.v1.Type*\325\001\n\010TypeCode\022\031\n\025TY"
63+
+ "oogle.spanner.v1.Type*\337\001\n\010TypeCode\022\031\n\025TY"
6464
+ "PE_CODE_UNSPECIFIED\020\000\022\010\n\004BOOL\020\001\022\t\n\005INT64"
6565
+ "\020\002\022\013\n\007FLOAT64\020\003\022\013\n\007FLOAT32\020\017\022\r\n\tTIMESTAM"
6666
+ "P\020\004\022\010\n\004DATE\020\005\022\n\n\006STRING\020\006\022\t\n\005BYTES\020\007\022\t\n\005"
6767
+ "ARRAY\020\010\022\n\n\006STRUCT\020\t\022\013\n\007NUMERIC\020\n\022\010\n\004JSON"
68-
+ "\020\013\022\t\n\005PROTO\020\r\022\010\n\004ENUM\020\016\022\014\n\010INTERVAL\020\020*d\n"
69-
+ "\022TypeAnnotationCode\022$\n TYPE_ANNOTATION_C"
70-
+ "ODE_UNSPECIFIED\020\000\022\016\n\nPG_NUMERIC\020\002\022\014\n\010PG_"
71-
+ "JSONB\020\003\022\n\n\006PG_OID\020\004B\254\001\n\025com.google.spann"
72-
+ "er.v1B\tTypeProtoP\001Z5cloud.google.com/go/"
73-
+ "spanner/apiv1/spannerpb;spannerpb\252\002\027Goog"
74-
+ "le.Cloud.Spanner.V1\312\002\027Google\\Cloud\\Spann"
75-
+ "er\\V1\352\002\032Google::Cloud::Spanner::V1b\006prot"
76-
+ "o3"
68+
+ "\020\013\022\t\n\005PROTO\020\r\022\010\n\004ENUM\020\016\022\014\n\010INTERVAL\020\020\022\010\n"
69+
+ "\004UUID\020\021*d\n\022TypeAnnotationCode\022$\n TYPE_AN"
70+
+ "NOTATION_CODE_UNSPECIFIED\020\000\022\016\n\nPG_NUMERI"
71+
+ "C\020\002\022\014\n\010PG_JSONB\020\003\022\n\n\006PG_OID\020\004B\254\001\n\025com.go"
72+
+ "ogle.spanner.v1B\tTypeProtoP\001Z5cloud.goog"
73+
+ "le.com/go/spanner/apiv1/spannerpb;spanne"
74+
+ "rpb\252\002\027Google.Cloud.Spanner.V1\312\002\027Google\\C"
75+
+ "loud\\Spanner\\V1\352\002\032Google::Cloud::Spanner"
76+
+ "::V1b\006proto3"
7777
};
7878
descriptor =
7979
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(

proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto

+4
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ enum TypeCode {
175175
// For example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2
176176
// months, 3 days, 4 hours, 5 minutes, and 6.5 seconds.
177177
INTERVAL = 16;
178+
179+
// Encoded as `string`, in lower-case hexa-decimal format, as described
180+
// in RFC 9562, section 4.
181+
UUID = 17;
178182
}
179183

180184
// `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to

renovate.json

-17
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@
4141
],
4242
"depNameTemplate": "com.google.cloud:sdk-platform-java-config",
4343
"datasourceTemplate": "maven"
44-
},
45-
{
46-
"fileMatch": [
47-
"^.github/workflows/hermetic_library_generation.yaml$"
48-
],
49-
"matchStrings": [
50-
"uses: googleapis/sdk-platform-java/.github/scripts@v(?<currentValue>.+?)\\n"
51-
],
52-
"depNameTemplate": "com.google.api:gapic-generator-java",
53-
"datasourceTemplate": "maven"
5444
}
5545
],
5646
"packageRules": [
@@ -111,13 +101,6 @@
111101
"^com.fasterxml.jackson.core"
112102
],
113103
"groupName": "jackson dependencies"
114-
},
115-
{
116-
"matchPackagePatterns": [
117-
"^com.google.api:gapic-generator-java",
118-
"^com.google.cloud:sdk-platform-java-config"
119-
],
120-
"groupName": "SDK platform Java dependencies"
121104
}
122105
],
123106
"semanticCommits": true,

0 commit comments

Comments
 (0)