Skip to content
Draft
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
1 change: 1 addition & 0 deletions .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ jobs:
base_ref: ${{ github.base_ref }}
head_ref: ${{ github.head_ref }}
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
force_regenerate_all: ${{ github.event.pull_request.head.ref == 'snapshot-generator' }}
image_tag: 2.68.1-SNAPSHOT # {x-version-update:gapic-generator-java:current}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.google.cloud.dataplex.v1;


/**
*
*
Expand Down
1 change: 1 addition & 0 deletions java-spanner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-java/
| List Databases Sample | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/ListDatabasesSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/ListDatabasesSample.java) |
| List Instance Config Operations Sample | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/ListInstanceConfigOperationsSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/ListInstanceConfigOperationsSample.java) |
| List Instance Configs Sample | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/ListInstanceConfigsSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/ListInstanceConfigsSample.java) |
| Mutable Credentials Example | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/MutableCredentialsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/MutableCredentialsExample.java) |
| Pg Alter Sequence Sample | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/PgAlterSequenceSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/PgAlterSequenceSample.java) |
| Pg Async Query To List Async Example | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/PgAsyncQueryToListAsyncExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/PgAsyncQueryToListAsyncExample.java) |
| Pg Async Runner Example | [source code](https://github.com/googleapis/google-cloud-java/blob/main/samples/snippets/src/main/java/com/example/spanner/PgAsyncRunnerExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-java&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/PgAsyncRunnerExample.java) |
Expand Down
7 changes: 6 additions & 1 deletion sdk-platform-java/.github/scripts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ inputs:
token:
description: Personal Access Token
required: true
force_regenerate_all:
description: true if we want to regenerate all libraries
required: false

runs:
using: "composite"
Expand Down Expand Up @@ -76,10 +79,12 @@ runs:
--target_branch "${BASE_REF}" \
--current_branch "${HEAD_REF}" \
--showcase_mode "${SHOWCASE_MODE}" \
--image_tag "${IMAGE_TAG}"
--image_tag "${IMAGE_TAG}" \
--force_regenerate_all "${FORCE_REGENERATE_ALL}"
env:
BASE_REF: ${{ inputs.base_ref }}
HEAD_REF: ${{ inputs.head_ref }}
IMAGE_TAG: ${{ inputs.image_tag }}
SHOWCASE_MODE: ${{ inputs.showcase_mode }}
GH_TOKEN: ${{ inputs.token }}
FORCE_REGENERATE_ALL: ${{ inputs.force_regenerate_all }}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ case "${key}" in
showcase_mode="$2"
shift
;;
--force_regenerate_all)
force_regenerate_all="$2"
shift
;;
*)
echo "Invalid option: [$1]"
exit 1
Expand Down Expand Up @@ -81,6 +85,10 @@ if [ -z "${image_tag}" ]; then
image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs)
fi

if [ -z "${force_regenerate_all}" ]; then
force_regenerate_all="false"
fi

workspace_name="/workspace"
baseline_generation_config="baseline_generation_config.yaml"
message="chore: generate libraries at $(date)"
Expand Down Expand Up @@ -109,7 +117,8 @@ fi
changed_libraries_file="$(mktemp)"
python hermetic_build/common/cli/get_changed_libraries.py create \
--baseline-generation-config-path="${baseline_generation_config}" \
--current-generation-config-path="${generation_config}" | tee "${changed_libraries_file}"
--current-generation-config-path="${generation_config}"\
--force-regenerate-all="${force_regenerate_all}" | tee "${changed_libraries_file}"
changed_libraries="$(cat "${changed_libraries_file}")"
echo "Changed libraries are: ${changed_libraries:-"No changed library"}."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import os
import click

from common.model.config_change import ConfigChange
from common.model.generation_config import GenerationConfig
from common.utils.generation_config_comparator import compare_config

Expand Down Expand Up @@ -51,9 +52,18 @@ def main(ctx):
metadata about library generation.
""",
)
@click.option(
"--force-regenerate-all",
required=False,
type=bool,
help="""
Force regenerate all libraries.
""",
)
def create(
baseline_generation_config_path: str,
current_generation_config_path: str,
force_regenerate_all: bool,
) -> None:
"""
Compares baseline generation config with current generation config and
Expand All @@ -77,6 +87,7 @@ def create(
config_change = compare_config(
baseline_config=GenerationConfig.from_yaml(baseline_generation_config_path),
current_config=GenerationConfig.from_yaml(current_generation_config_path),
force_regenerate_all=force_regenerate_all,
)
click.echo(",".join(config_change.get_changed_libraries()))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@


def compare_config(
baseline_config: GenerationConfig, current_config: GenerationConfig
baseline_config: GenerationConfig,
current_config: GenerationConfig,
force_regenerate_all: bool = False,
) -> ConfigChange:
"""
Compare two GenerationConfig object and output a mapping from ConfigChange
Expand All @@ -48,6 +50,12 @@ def compare_config(
current_params = __convert_params_to_sorted_list(
obj=current_config, excluded_params=excluded_params
)
if force_regenerate_all:
config_change = LibraryChange(
changed_param="force_regenerate_all",
current_value="true",
)
diff[ChangeType.REPO_LEVEL_CHANGE].append(config_change)

for baseline_param, current_param in zip(baseline_params, current_params):
if baseline_param == current_param:
Expand All @@ -60,7 +68,6 @@ def compare_config(
current_value=current_param[1],
)
diff[ChangeType.REPO_LEVEL_CHANGE].append(config_change)

__compare_libraries(
diff=diff,
baseline_library_configs=baseline_config.libraries,
Expand Down
Loading