Skip to content

Commit b75a15b

Browse files
vchudnov-gparthea
andauthored
chore(migration): ensure package name is added in .OwlBot.yaml paths (#11166)
* chore(migration): ensure package name is added in .OwlBot.yaml paths This is motivated by the need to include the mono-repo package name in `deep-preserve-regex` expressions as well. The solution here simplifies the post-processing code, and assumes that every ` /owl-bot-staging/` needs to become ` /owl-bot-staging/PACKAGE/` * Make the replacement global to affect all occurrences --------- Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 1ba2ef7 commit b75a15b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

scripts/split_repo_migration/single-library.post-process.api-files.sh

+5-11
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,11 @@ OWY_SPLIT_PATH="${PATH_PACKAGE}/.github/.OwlBot.yaml"
159159
# remove `image:` line
160160
sed -i "/image:/d" "${OWY_MONO_PATH}"
161161

162-
# In the nodejs case, lines #1 and #2 below are treated as a disjoint case from
163-
# line #3. However, in Python we see cases (eg aiplatform) where there are
164-
# multiple entries in the same file that satisfy either of the criteria. As a
165-
# result, we search for both cases. In doing that, to prevent #3 from altering
166-
# lines already modified by #2, we temporarily insert ${TMP_MARKER} and remove
167-
# it in #4
168-
TMP_MARKER="<<__tmp__>>>"
169-
sed -i 's|\.\*-py/(.*)|.*-py|' "${OWY_MONO_PATH}" #1
170-
sed -i "s|dest: /owl-bot-staging/\$1/\$2|dest: /owl-bot-${TMP_MARKER}staging/${MONOREPO_PACKAGE_NAME}/\$1|" "${OWY_MONO_PATH}" #2
171-
sed -i "s|dest: /owl-bot-staging|dest: \/owl-bot-staging\/${MONOREPO_PACKAGE_NAME}/|" "${OWY_MONO_PATH}" #3
172-
sed -i "s|${TMP_MARKER}||" "${OWY_MONO_PATH}" #4
162+
# The order of lines A and B below matters, since we DO want lines affected by
163+
# A to be further affected by B.
164+
sed -i 's|\.\*-py/(.*)|.*-py|' "${OWY_MONO_PATH}"
165+
sed -i "s|dest: /owl-bot-staging/\$1/\$2|dest: /owl-bot-staging/\$1|" "${OWY_MONO_PATH}" # A
166+
sed -i "s| /owl-bot-staging/| /owl-bot-staging/${MONOREPO_PACKAGE_NAME}/|g" "${OWY_MONO_PATH}" # B
173167

174168
# TODO: Review the following: For consistency with NodeJS migration script:
175169
# - we are not removing `begin-after-commit-hash`

0 commit comments

Comments
 (0)