Skip to content

Commit

Permalink
Merge branch 'main' into gfe_latency
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhigarg92 authored Jan 3, 2025
2 parents 7383362 + eee333b commit b6bd6f2
Show file tree
Hide file tree
Showing 692 changed files with 14,343 additions and 4,211 deletions.
63 changes: 55 additions & 8 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,6 +60,10 @@ case "${key}" in
generation_config="$2"
shift
;;
--workflow)
workflow="$2"
shift
;;
*)
echo "Invalid option: [$1]"
exit 1
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ branchProtectionRules:
- compile (11)
- units-with-multiplexed-session (8)
- units-with-multiplexed-session (11)
- unmanaged_dependency_check
- library_generation
- pattern: 3.3.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
env:
JOB_TYPE: test
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS: true
units-java8:
# Building using Java 17 and run the tests with Java 8 runtime
name: "units (8)"
Expand Down Expand Up @@ -92,6 +93,7 @@ jobs:
env:
JOB_TYPE: test
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS: true
windows:
runs-on: windows-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- uses: googleapis/sdk-platform-java/.github/scripts@v2.50.0
- uses: googleapis/sdk-platform-java/.github/scripts@v2.51.0
if: env.SHOULD_RUN == 'true'
with:
base_ref: ${{ github.base_ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unmanaged_dependency_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
# repository
.kokoro/build.sh
- name: Unmanaged dependency check
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.40.0
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.41.0
with:
bom-path: google-cloud-spanner-bom/pom.xml
12 changes: 9 additions & 3 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ integration-directpath-enabled)
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dmaven.main.skip=true \
-Dspanner.gce.config.project_id=gcloud-devel \
-Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-directpath \
-Dspanner.testenv.instance=projects/span-cloud-testing/instances/spanner-java-client-directpath \
-Dspanner.gce.config.project_id=span-cloud-testing \
-fae \
verify
RETURN_CODE=$?
Expand Down Expand Up @@ -206,12 +206,17 @@ slowtests)
verify
RETURN_CODE=$?
;;
samples)
samples|samples-slow-tests)
SAMPLES_DIR=samples
PROFILES=''
# only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise.
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]]
then
SAMPLES_DIR=samples/snapshot
elif [[ ${JOB_TYPE} = 'samples-slow-tests' ]]
then
SAMPLES_DIR=samples/snippets
PROFILES='-Pslow-tests,!integration-tests'
fi

if [[ -f ${SAMPLES_DIR}/pom.xml ]]
Expand All @@ -227,6 +232,7 @@ samples)
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
${PROFILES} \
-fae \
verify
RETURN_CODE=$?
Expand Down
12 changes: 0 additions & 12 deletions .kokoro/continuous/java8.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions .kokoro/nightly/integration-directpath-enabled.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ env_vars: {

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
value: "secret_manager/java-client-testing"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
value: "java-client-testing"
}

env_vars: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env_vars: {

env_vars: {
key: "JOB_TYPE"
value: "samples"
value: "samples-slow-tests"
}

# TODO: remove this after we've migrated all tests and scripts
Expand All @@ -32,3 +32,8 @@ env_vars: {
value: "java-it-service-account"
}

env_vars: {
key: "ENABLE_BUILD_COP"
value: "true"
}

7 changes: 0 additions & 7 deletions .kokoro/nightly/java7.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions .kokoro/nightly/java8-win.cfg

This file was deleted.

13 changes: 0 additions & 13 deletions .kokoro/presubmit/clirr.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-17.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.40.0"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.41.0"
}

env_vars: {
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.40.0"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.41.0"
}

env_vars: {
Expand Down
22 changes: 0 additions & 22 deletions .kokoro/presubmit/integration-cloud-devel.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions .kokoro/presubmit/integration-directpath-enabled.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ env_vars: {

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
value: "secret_manager/java-client-testing"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
value: "java-client-testing"
}

env_vars: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ env_vars: {
key: "GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS"
value: "true"
}

env_vars: {
key: "GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS"
value: "true"
}
7 changes: 0 additions & 7 deletions .kokoro/presubmit/java11.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions .kokoro/presubmit/java7.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions .kokoro/presubmit/java8-osx.cfg

This file was deleted.

34 changes: 0 additions & 34 deletions .kokoro/presubmit/java8-samples.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions .kokoro/presubmit/java8-win.cfg

This file was deleted.

Loading

0 comments on commit b6bd6f2

Please sign in to comment.