Skip to content

Commit 9aabeed

Browse files
meltsufinchingor13
andauthored
chore: improve monorepo migration tooling (#12962)
Updates migration automation scripts as part of the effort to migrate java-pubsub, java-firestore, and java-bigtable into the monorepo. --------- Co-authored-by: chingor13 <chingor@google.com>
1 parent a7e05cf commit 9aabeed

21 files changed

Lines changed: 860 additions & 142 deletions

.github/workflows/ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112
outputs:
113113
packages: ${{ steps.filter.outputs.changes }}
114114
steps:
115+
- uses: actions/checkout@v4
115116
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
116117
id: filter
117118
with:
@@ -338,8 +339,8 @@ jobs:
338339
- run: .kokoro/build.sh
339340
env:
340341
JOB_TYPE: lint
341-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
342-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
342+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
343+
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
343344
enforcer:
344345
runs-on: ubuntu-latest
345346
steps:

.github/workflows/java-bigtable-ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ jobs:
137137
- run: .kokoro/build.sh
138138
env:
139139
JOB_TYPE: lint
140-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
141-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
140+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
141+
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
142142
clirr:
143143
needs: filter
144144
if: ${{ needs.filter.outputs.library == 'true' }}

.github/workflows/java-pubsub-ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ jobs:
137137
- run: .kokoro/build.sh
138138
env:
139139
JOB_TYPE: lint
140-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
141-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
140+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
141+
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
142142
clirr:
143143
needs: filter
144144
if: ${{ needs.filter.outputs.library == 'true' }}

.github/workflows/java-spanner-jdbc-ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ jobs:
141141
- run: .kokoro/build.sh
142142
env:
143143
JOB_TYPE: lint
144-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
145-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
144+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
145+
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
146146
required:
147147
needs: [ units, units-java8, windows, dependencies, javadoc, lint ]
148148
name: conditional-required-check

.github/workflows/java-storage-nio-ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ jobs:
141141
- run: .kokoro/build.sh
142142
env:
143143
JOB_TYPE: lint
144-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
145-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
144+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
145+
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
146146
required:
147147
needs: [ units, units-java8, windows, dependencies, javadoc, lint ]
148148
name: conditional-required-check

generation/apply_versions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if [[ "$column_name" == "released" ]]; then
2525
column_index=2
2626
elif [[ "$column_name" == "current" ]]; then
2727
column_index=3
28-
elif "$column_name" != "current" ]]; then
28+
elif [[ "$column_name" != "current" ]]; then
2929
echo "Error: column_name must be either 'released' or 'current'"
3030
exit 1
3131
fi

generation/update_owlbot_postprocessor_config.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
set -e
88

9-
for dir in $(find . -mindepth 2 -maxdepth 2 -name owlbot.py | grep -v 'java-common-protos/' | grep -v 'java-iam/' | grep -v 'java-showcase/' | sort | xargs dirname ); do
9+
TARGET_MODULE="${1:-.}"
10+
11+
for owlbot_script in $(find "$TARGET_MODULE" -name owlbot.py | grep -v 'java-common-protos/' | grep -v 'java-iam/' | grep -v 'java-showcase/' | sort); do
12+
dir=$(dirname "$owlbot_script")
1013
pushd "$dir"
1114

1215
# form a perl command to replace java.common_templates() invocation

monorepo-migration/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git-filter-repo/
2+
__pycache__/
3+
*.pyc
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Exit on error
17+
set -e
18+
19+
# Get absolute paths
20+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21+
MONOREPO_ROOT="$(dirname "$SCRIPT_DIR")"
22+
23+
echo "========================================================"
24+
echo " Staging java-bigtable migration"
25+
echo "========================================================"
26+
27+
# 1. Configure environment for the base migrate.sh script
28+
export SOURCE_REPO_URL="https://github.com/googleapis/java-bigtable"
29+
export MIGRATION_HEAD_BRANCH="main"
30+
export SQUASH_COMMITS="false"
31+
export CODEOWNER="@googleapis/bigtable-team"
32+
export BOM_SUBSTITUTIONS="gapic-libraries-bom:google-cloud-monitoring-bom"
33+
export PRE_INSTALL_DEPS="java-monitoring/google-cloud-monitoring-bom,java-monitoring/google-cloud-monitoring"
34+
35+
# 2. Execute the central migration script
36+
"${SCRIPT_DIR}/migrate.sh"
37+
38+
echo ""
39+
echo "========================================================"
40+
echo "Migration staged successfully!"
41+
echo "Results are available in the isolated clone:"
42+
echo " migration-work/google-cloud-java-target"
43+
echo "Current Branch: migrate-java-bigtable"
44+
echo "Next Steps: cd migration-work/google-cloud-java-target && mvn clean install -DskipTests"
45+
echo "========================================================"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Exit on error
17+
set -e
18+
19+
# Get absolute paths
20+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21+
MONOREPO_ROOT="$(dirname "$SCRIPT_DIR")"
22+
23+
echo "========================================================"
24+
echo " Staging java-firestore migration"
25+
echo "========================================================"
26+
27+
# 1. Configure environment for the base migrate.sh script
28+
export SOURCE_REPO_URL="https://github.com/googleapis/java-firestore"
29+
export MIGRATION_HEAD_BRANCH="main"
30+
export SQUASH_COMMITS="false"
31+
export CODEOWNER="@googleapis/firestore-team"
32+
33+
# 2. Execute the central migration script
34+
"${SCRIPT_DIR}/migrate.sh"
35+
36+
echo ""
37+
echo "========================================================"
38+
echo "Migration staged successfully!"
39+
echo "Results are available in the isolated clone:"
40+
echo " migration-work/google-cloud-java-target"
41+
echo "Current Branch: migrate-java-firestore"
42+
echo "Next Steps: cd migration-work/google-cloud-java-target && mvn clean install -DskipTests"
43+
echo "========================================================"

0 commit comments

Comments
 (0)