@@ -220,24 +220,32 @@ EOF
220220 COMMIT_COUNT=$(( COMMIT_COUNT + 1 ))
221221fi
222222
223- # 6.4c Migrate Integration presubmit config if present
224- if [ -f " $SOURCE_REPO_NAME /.kokoro/presubmit/integration.cfg" ]; then
225- echo " Migrating integration.cfg to monorepo root .kokoro/presubmit/${SOURCE_REPO_NAME# java-} -integration.cfg..."
223+ # 6.4c Migrate Integration presubmit configurations if present
224+ if ls " $SOURCE_REPO_NAME /.kokoro/presubmit/integration" * .cfg > /dev/null 2>&1 ; then
226225 mkdir -p .kokoro/presubmit
227- sed -e ' s/value: "integration"/value: "integration-single"/' \
228- -e ' s/java8/java11/' \
229- " $SOURCE_REPO_NAME /.kokoro/presubmit/integration.cfg" > " .kokoro/presubmit/${SOURCE_REPO_NAME# java-} -integration.cfg"
230-
231- # Append BUILD_SUBDIR
232- cat << EOF >> ".kokoro/presubmit/${SOURCE_REPO_NAME# java-} -integration.cfg"
226+ for cfg_file in " $SOURCE_REPO_NAME /.kokoro/presubmit/integration" * .cfg; do
227+ if [ -f " $cfg_file " ]; then
228+ filename=$( basename " $cfg_file " )
229+ new_filename=" ${filename/ integration/ ${SOURCE_REPO_NAME# java-} -integration} "
230+ target_cfg=" .kokoro/presubmit/${new_filename} "
231+
232+ echo " Migrating and adapting $filename to $target_cfg ..."
233+ sed -e ' s/value: "integration"/value: "integration-single"/' \
234+ -e ' s/java8/java11/' \
235+ " $cfg_file " > " $target_cfg "
236+
237+ # Append BUILD_SUBDIR
238+ cat << EOF >> "$target_cfg "
233239
234240env_vars: {
235241 key: "BUILD_SUBDIR"
236242 value: "${SOURCE_REPO_NAME} "
237243}
238244EOF
239- git add " .kokoro/presubmit/${SOURCE_REPO_NAME# java-} -integration.cfg"
240- git commit -n --no-gpg-sign -m " chore($SOURCE_REPO_NAME ): migrate Integration presubmit config"
245+ git add " $target_cfg "
246+ fi
247+ done
248+ git commit -n --no-gpg-sign -m " chore($SOURCE_REPO_NAME ): migrate Integration presubmit configurations"
241249 COMMIT_COUNT=$(( COMMIT_COUNT + 1 ))
242250fi
243251
0 commit comments