diff --git a/.github/scripts/update_generation_config.sh b/.github/scripts/update_generation_config.sh index 561a313040f..91434688cc5 100644 --- a/.github/scripts/update_generation_config.sh +++ b/.github/scripts/update_generation_config.sh @@ -28,11 +28,23 @@ function update_config() { sed -i -e "s/^${key_word}.*$/${key_word}: ${new_value}/" "${file}" } +# Update an action to a new version in GitHub action. +function update_action() { + local key_word=$1 + local new_value=$2 + local file=$3 + echo "Update ${key_word} to ${new_value} in ${file}" + # use a different delimiter because the key_word contains "/". + sed -i -e "s|${key_word}@v.*$|${key_word}@v${new_value}|" "${file}" +} + # The parameters of this script is: # 1. base_branch, the base branch of the result pull request. # 2. repo, organization/repo-name, e.g., googleapis/google-cloud-java # 3. [optional] generation_config, the path to the generation configuration, # the default value is generation_config.yaml in the repository root. +# 4. [optional] workflow, the library generation workflow file, +# the default value is .github/workflows/hermetic_library_generation.yaml. while [[ $# -gt 0 ]]; do key="$1" case "${key}" in @@ -48,6 +60,10 @@ case "${key}" in generation_config="$2" shift ;; + --workflow) + workflow="$2" + shift + ;; *) echo "Invalid option: [$1]" exit 1 @@ -71,21 +87,34 @@ if [ -z "${generation_config}" ]; then echo "Use default generation config: ${generation_config}" fi +if [ -z "${workflow}" ]; then + workflow=".github/workflows/hermetic_library_generation.yaml" + echo "Use default library generation workflow file: ${workflow}" +fi + current_branch="generate-libraries-${base_branch}" title="chore: Update generation configuration at $(date)" -# try to find a open pull request associated with the branch +git checkout "${base_branch}" +# Try to find a open pull request associated with the branch pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number") -# create a branch if there's no open pull request associated with the +# Create a branch if there's no open pull request associated with the # branch; otherwise checkout the pull request. if [ -z "${pr_num}" ]; then git checkout -b "${current_branch}" + # Push the current branch to remote so that we can + # compare the commits later. + git push -u origin "${current_branch}" else gh pr checkout "${pr_num}" fi +# Only allow fast-forward merging; exit with non-zero result if there's merging +# conflict. +git merge -m "chore: merge ${base_branch} into ${current_branch}" "${base_branch}" + mkdir tmp-googleapis -# use partial clone because only commit history is needed. +# Use partial clone because only commit history is needed. git clone --filter=blob:none https://github.com/googleapis/googleapis.git tmp-googleapis pushd tmp-googleapis git pull @@ -94,25 +123,43 @@ popd rm -rf tmp-googleapis update_config "googleapis_commitish" "${latest_commit}" "${generation_config}" -# update gapic-generator-java version to the latest +# Update gapic-generator-java version to the latest latest_version=$(get_latest_released_version "com.google.api" "gapic-generator-java") update_config "gapic_generator_version" "${latest_version}" "${generation_config}" -# update libraries-bom version to the latest +# Update composite action version to latest gapic-generator-java version +update_action "googleapis/sdk-platform-java/.github/scripts" \ + "${latest_version}" \ + "${workflow}" + +# Update libraries-bom version to the latest latest_version=$(get_latest_released_version "com.google.cloud" "libraries-bom") update_config "libraries_bom_version" "${latest_version}" "${generation_config}" -git add "${generation_config}" +git add "${generation_config}" "${workflow}" changed_files=$(git diff --cached --name-only) if [[ "${changed_files}" == "" ]]; then echo "The latest generation config is not changed." echo "Skip committing to the pull request." +else + git commit -m "${title}" +fi + +# There are potentially at most two commits: merge commit and change commit. +# We want to exit the script if no commit happens (otherwise this will be an +# infinite loop). +# `git cherry` is a way to find whether the local branch has commits that are +# not in the remote branch. +# If we find any such commit, push them to remote branch. +unpushed_commit=$(git cherry -v "origin/${current_branch}" | wc -l) +if [[ "${unpushed_commit}" -eq 0 ]]; then + echo "No unpushed commits, exit" exit 0 fi -git commit -m "${title}" + if [ -z "${pr_num}" ]; then git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git" - git fetch -q --unshallow remote_repo + git fetch -q remote_repo git push -f remote_repo "${current_branch}" gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}" else diff --git a/README.md b/README.md index 29f1bb0322d..296dd00f422 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.50.0') +implementation platform('com.google.cloud:libraries-bom:26.51.0') implementation 'com.google.cloud:google-cloud-spanner' ``` diff --git a/generation_config.yaml b/generation_config.yaml index ef44b5b9dea..f7c5f12a081 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,6 +1,6 @@ -gapic_generator_version: 2.50.0 -googleapis_commitish: 349841abac6c3e580ccce6e3d6fcc182ed2512c2 -libraries_bom_version: 26.50.0 +gapic_generator_version: 2.51.0 +googleapis_commitish: 7d0c6bee2517d77635beb2a1dd6d6e7d4d943512 +libraries_bom_version: 26.51.0 libraries: - api_shortname: spanner name_pretty: Cloud Spanner diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java index 9c36f6c971b..9db5e0c186e 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java @@ -228,6 +228,17 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum { * INTERVAL = 16; */ INTERVAL(16), + /** + * + * + *
+   * Encoded as `string`, in lower-case hexa-decimal format, as described
+   * in RFC 9562, section 4.
+   * 
+ * + * UUID = 17; + */ + UUID(17), UNRECOGNIZED(-1), ; @@ -424,6 +435,17 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum { * INTERVAL = 16; */ public static final int INTERVAL_VALUE = 16; + /** + * + * + *
+   * Encoded as `string`, in lower-case hexa-decimal format, as described
+   * in RFC 9562, section 4.
+   * 
+ * + * UUID = 17; + */ + public static final int UUID_VALUE = 17; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -481,6 +503,8 @@ public static TypeCode forNumber(int value) { return ENUM; case 16: return INTERVAL; + case 17: + return UUID; default: return null; } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java index 3c41d2585b4..e640269d997 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java @@ -60,20 +60,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "pe_fqn\030\005 \001(\t\"\177\n\nStructType\0223\n\006fields\030\001 \003" + "(\0132#.google.spanner.v1.StructType.Field\032" + "<\n\005Field\022\014\n\004name\030\001 \001(\t\022%\n\004type\030\002 \001(\0132\027.g" - + "oogle.spanner.v1.Type*\325\001\n\010TypeCode\022\031\n\025TY" + + "oogle.spanner.v1.Type*\337\001\n\010TypeCode\022\031\n\025TY" + "PE_CODE_UNSPECIFIED\020\000\022\010\n\004BOOL\020\001\022\t\n\005INT64" + "\020\002\022\013\n\007FLOAT64\020\003\022\013\n\007FLOAT32\020\017\022\r\n\tTIMESTAM" + "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" + "ARRAY\020\010\022\n\n\006STRUCT\020\t\022\013\n\007NUMERIC\020\n\022\010\n\004JSON" - + "\020\013\022\t\n\005PROTO\020\r\022\010\n\004ENUM\020\016\022\014\n\010INTERVAL\020\020*d\n" - + "\022TypeAnnotationCode\022$\n TYPE_ANNOTATION_C" - + "ODE_UNSPECIFIED\020\000\022\016\n\nPG_NUMERIC\020\002\022\014\n\010PG_" - + "JSONB\020\003\022\n\n\006PG_OID\020\004B\254\001\n\025com.google.spann" - + "er.v1B\tTypeProtoP\001Z5cloud.google.com/go/" - + "spanner/apiv1/spannerpb;spannerpb\252\002\027Goog" - + "le.Cloud.Spanner.V1\312\002\027Google\\Cloud\\Spann" - + "er\\V1\352\002\032Google::Cloud::Spanner::V1b\006prot" - + "o3" + + "\020\013\022\t\n\005PROTO\020\r\022\010\n\004ENUM\020\016\022\014\n\010INTERVAL\020\020\022\010\n" + + "\004UUID\020\021*d\n\022TypeAnnotationCode\022$\n TYPE_AN" + + "NOTATION_CODE_UNSPECIFIED\020\000\022\016\n\nPG_NUMERI" + + "C\020\002\022\014\n\010PG_JSONB\020\003\022\n\n\006PG_OID\020\004B\254\001\n\025com.go" + + "ogle.spanner.v1B\tTypeProtoP\001Z5cloud.goog" + + "le.com/go/spanner/apiv1/spannerpb;spanne" + + "rpb\252\002\027Google.Cloud.Spanner.V1\312\002\027Google\\C" + + "loud\\Spanner\\V1\352\002\032Google::Cloud::Spanner" + + "::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto index 734cfb54cda..a8a73bf31ee 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto @@ -175,6 +175,10 @@ enum TypeCode { // For example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2 // months, 3 days, 4 hours, 5 minutes, and 6.5 seconds. INTERVAL = 16; + + // Encoded as `string`, in lower-case hexa-decimal format, as described + // in RFC 9562, section 4. + UUID = 17; } // `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to diff --git a/renovate.json b/renovate.json index 167bf279fe7..3ad0aae27d8 100644 --- a/renovate.json +++ b/renovate.json @@ -41,16 +41,6 @@ ], "depNameTemplate": "com.google.cloud:sdk-platform-java-config", "datasourceTemplate": "maven" - }, - { - "fileMatch": [ - "^.github/workflows/hermetic_library_generation.yaml$" - ], - "matchStrings": [ - "uses: googleapis/sdk-platform-java/.github/scripts@v(?.+?)\\n" - ], - "depNameTemplate": "com.google.api:gapic-generator-java", - "datasourceTemplate": "maven" } ], "packageRules": [ @@ -111,13 +101,6 @@ "^com.fasterxml.jackson.core" ], "groupName": "jackson dependencies" - }, - { - "matchPackagePatterns": [ - "^com.google.api:gapic-generator-java", - "^com.google.cloud:sdk-platform-java-config" - ], - "groupName": "SDK platform Java dependencies" } ], "semanticCommits": true,