Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update generation configuration at Wed Sep 25 23:44:01 UTC 2024 #2189

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,24 @@ message="chore: generate libraries at $(date)"

git checkout "${target_branch}"
git checkout "${current_branch}"
# if the last commit doesn't contain changes to generation configuration,
# do not generate again as the result will be the same.
change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)"
if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then
echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true
exit 0
fi

# copy generation configuration from target branch to current branch.
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)

# parse image tag from the generation configuration.
image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs)

repo_root_dir=$(pwd)
mkdir -p "${repo_root_dir}/output"
# download api definitions from googleapis repository
googleapis_commitish=$(grep googleapis_commitish "${generation_config}" | cut -d ":" -f 2 | xargs)
api_def_dir=$(mktemp -d)
git clone https://github.com/googleapis/googleapis.git "${api_def_dir}"
pushd "${api_def_dir}"
git checkout "${googleapis_commitish}"
cp -r google/ grafeas/ "${repo_root_dir}/output"
popd

# run hermetic code generation docker image.
docker run \
--rm \
Expand All @@ -90,26 +94,21 @@ docker run \
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
--current-generation-config-path="${workspace_name}/${generation_config}"

# remove api definitions after generation
rm -rf "${api_def_dir}"

# commit the change to the pull request.
if [[ $(basename $(pwd)) == "google-cloud-java" ]]; then
git add java-* pom.xml gapic-libraries-bom/pom.xml versions.txt
else
# The image leaves intermediate folders and files it works with. Here we remove them
rm -rdf output googleapis "${baseline_generation_config}"
git add --all -- ':!pr_description.txt'
fi
rm -rdf output googleapis "${baseline_generation_config}"
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" == "" ]]; then
echo "There is no generated code change with the generation config change ${config_diff}."
echo "Skip committing to the pull request."
exit 0
if [[ "${changed_files}" != "" ]]; then
echo "Commit changes..."
git commit -m "${message}"
git push
else
echo "There is no generated code change, skip commit."
fi

echo "Configuration diff:"
echo "${config_diff}"
git commit -m "${message}"
git push
# set pr body if pr_description.txt is generated.
if [[ -f "pr_description.txt" ]]; then
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ on:
env:
HEAD_REF: ${{ github.head_ref }}
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
GITHUB_REPOSITORY: ${{ github.repository }}

jobs:
library_generation:
# skip pull requests coming from a forked repository
if: github.env.REPO_FULL_NAME == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -35,6 +34,10 @@ jobs:
shell: bash
run: |
set -ex
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
echo "This PR comes from a fork. Generation will be skipped"
exit 0
fi
[ -z "$(git config user.email)" ] && git config --global user.email "[email protected]"
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
bash .github/scripts/hermetic_library_generation.sh \
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.44.0</version>
<version>26.47.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -44,28 +44,28 @@ If you are using Maven without the BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>1.132.0</version>
<version>1.132.2</version>
</dependency>

```

If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.44.0')
implementation platform('com.google.cloud:libraries-bom:26.47.0')

implementation 'com.google.cloud:google-cloud-pubsub'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-pubsub:1.132.0'
implementation 'com.google.cloud:google-cloud-pubsub:1.132.2'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.132.0"
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.132.2"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -414,7 +414,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.132.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.132.2
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
2 changes: 1 addition & 1 deletion generation_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gapic_generator_version: 2.46.0
googleapis_commitish: 5c181aaf78bd1ae2e08c3a2971cd9e87b6e00986
googleapis_commitish: 005df4681b89bd204a90b76168a6dc9d9e7bf4fe
libraries_bom_version: 26.47.0
libraries:
- api_shortname: pubsub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createSchema to 30 seconds:
* <p>For example, to set the
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
* of createSchema:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand All @@ -88,10 +90,21 @@
* .createSchemaSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
* .setMaxAttempts(5)
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
* .setRetryDelayMultiplier(1.3)
* .setRpcTimeoutMultiplier(1.5)
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
* }</pre>
*
* Please refer to the [Client Side Retry
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
* additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class SchemaServiceSettings extends ClientSettings<SchemaServiceSettings> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,8 @@ public final Subscription createSubscription(
* .setDetached(true)
* .setEnableExactlyOnceDelivery(true)
* .setTopicMessageRetentionDuration(Duration.newBuilder().build())
* .setAnalyticsHubSubscriptionInfo(
* Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build())
* .build();
* Subscription response = subscriptionAdminClient.createSubscription(request);
* }
Expand Down Expand Up @@ -1141,6 +1143,8 @@ public final Subscription createSubscription(
* .setDetached(true)
* .setEnableExactlyOnceDelivery(true)
* .setTopicMessageRetentionDuration(Duration.newBuilder().build())
* .setAnalyticsHubSubscriptionInfo(
* Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build())
* .build();
* ApiFuture<Subscription> future =
* subscriptionAdminClient.createSubscriptionCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createSubscription to 30 seconds:
* <p>For example, to set the
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
* of createSubscription:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand All @@ -97,10 +99,21 @@
* .createSubscriptionSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
* .setMaxAttempts(5)
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
* .setRetryDelayMultiplier(1.3)
* .setRpcTimeoutMultiplier(1.5)
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* SubscriptionAdminSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
* }</pre>
*
* Please refer to the [Client Side Retry
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
* additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class SubscriptionAdminSettings extends ClientSettings<SubscriptionAdminSettings> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createTopic to 30 seconds:
* <p>For example, to set the
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
* of createTopic:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand All @@ -89,10 +91,21 @@
* .createTopicSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
* .setMaxAttempts(5)
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
* .setRetryDelayMultiplier(1.3)
* .setRpcTimeoutMultiplier(1.5)
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
* }</pre>
*
* Please refer to the [Client Side Retry
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
* additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class TopicAdminSettings extends ClientSettings<TopicAdminSettings> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createTopic to 30 seconds:
* <p>For example, to set the
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
* of createTopic:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand All @@ -116,10 +118,21 @@
* .createTopicSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
* .setMaxAttempts(5)
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
* .setRetryDelayMultiplier(1.3)
* .setRpcTimeoutMultiplier(1.5)
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* PublisherStubSettings topicAdminSettings = topicAdminSettingsBuilder.build();
* }</pre>
*
* Please refer to the [Client Side Retry
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
* additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
Expand Down Expand Up @@ -182,9 +195,7 @@ public String extractNextToken(ListTopicsResponse payload) {

@Override
public Iterable<Topic> extractResources(ListTopicsResponse payload) {
return payload.getTopicsList() == null
? ImmutableList.<Topic>of()
: payload.getTopicsList();
return payload.getTopicsList();
}
};

Expand Down Expand Up @@ -224,9 +235,7 @@ public String extractNextToken(ListTopicSubscriptionsResponse payload) {

@Override
public Iterable<String> extractResources(ListTopicSubscriptionsResponse payload) {
return payload.getSubscriptionsList() == null
? ImmutableList.<String>of()
: payload.getSubscriptionsList();
return payload.getSubscriptionsList();
}
};

Expand Down Expand Up @@ -263,9 +272,7 @@ public String extractNextToken(ListTopicSnapshotsResponse payload) {

@Override
public Iterable<String> extractResources(ListTopicSnapshotsResponse payload) {
return payload.getSnapshotsList() == null
? ImmutableList.<String>of()
: payload.getSnapshotsList();
return payload.getSnapshotsList();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createSchema to 30 seconds:
* <p>For example, to set the
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
* of createSchema:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand All @@ -107,10 +109,21 @@
* .createSchemaSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
* .setMaxAttempts(5)
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
* .setRetryDelayMultiplier(1.3)
* .setRpcTimeoutMultiplier(1.5)
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
* .build());
* SchemaServiceStubSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
* }</pre>
*
* Please refer to the [Client Side Retry
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
* additional support in setting retries.
*/
@Generated("by gapic-generator-java")
public class SchemaServiceStubSettings extends StubSettings<SchemaServiceStubSettings> {
Expand Down Expand Up @@ -171,9 +184,7 @@ public String extractNextToken(ListSchemasResponse payload) {

@Override
public Iterable<Schema> extractResources(ListSchemasResponse payload) {
return payload.getSchemasList() == null
? ImmutableList.<Schema>of()
: payload.getSchemasList();
return payload.getSchemasList();
}
};

Expand Down Expand Up @@ -211,9 +222,7 @@ public String extractNextToken(ListSchemaRevisionsResponse payload) {

@Override
public Iterable<Schema> extractResources(ListSchemaRevisionsResponse payload) {
return payload.getSchemasList() == null
? ImmutableList.<Schema>of()
: payload.getSchemasList();
return payload.getSchemasList();
}
};

Expand Down
Loading
Loading