From 670d76f951652daa12729fb1287d22b5bd910b1d Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 3 Dec 2021 11:56:36 -0800 Subject: [PATCH] Use ci_matching_branch/ in bump_dependency.bash (#580) * Part of #564. * Fix replacing ign-fuel-tools branch name with main Replace branch name before swapping - for _ in DEP_LIB. * Make source code pull request after metadata The source code PRs will fail without the metadata, so commit the metadata first. Signed-off-by: Steve Peters --- release-repo-scripts/bump_dependency.bash | 84 +++++++++++------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/release-repo-scripts/bump_dependency.bash b/release-repo-scripts/bump_dependency.bash index 7a6c859b6..5135dbf5f 100755 --- a/release-repo-scripts/bump_dependency.bash +++ b/release-repo-scripts/bump_dependency.bash @@ -181,7 +181,7 @@ commitAndPR() { # Sanity check that we're on a bump branch already local CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - if [[ ! $CURRENT_BRANCH = bump_* ]] + if [[ ! $CURRENT_BRANCH =~ bump_* ]] then echo -e "${RED}${REPO}: Something's wrong, trying to commit to branch ${CURRENT_BRANCH}.${DEFAULT}" return @@ -313,49 +313,10 @@ for ((i = 0; i < "${#LIBRARIES[@]}"; i++)); do PREV_VER="$((${VER}-1))" LIB_UPPER=`echo ${LIB#"ign-"} | tr a-z A-Z` ORG=${IGN_ORG} - BUMP_BRANCH="bump_${COLLECTION}_${LIB}${VER}" + BUMP_BRANCH="ci_matching_branch/bump_${COLLECTION}_${LIB}${VER}" echo -e "${BLUE_BG}Processing [${LIB}]${DEFAULT_BG}" - ################## - # source code - ################## - - echo -e "${GREEN}${LIB}: source code${DEFAULT}" - - cloneIfNeeded ${ORG} ${LIB} - startFromCleanBranch ${BUMP_BRANCH} main - - # Check if main branch of that library is the correct version - PROJECT_NAME="${LIB_}${VER}" - PROJECT_NAME="${PROJECT_NAME/ign_/ignition-}" - PROJECT="project.*(${PROJECT_NAME}" - if ! grep -q ${PROJECT} "CMakeLists.txt"; then - echo -e "${RED}Wrong project name on [CMakeLists.txt], looking for [$PROJECT_NAME].${DEFAULT}" - exit - fi - - echo -e "${GREEN}${LIB}: Updating source code${DEFAULT}" - for ((j = 0; j < "${#LIBRARIES[@]}"; j++)); do - - DEP_LIB=${LIBRARIES[$j]#"ign-"} - DEP_VER=${VERSIONS[$j]} - DEP_PREV_VER="$((${DEP_VER}-1))" - - find . -type f ! -name 'Changelog.md' ! -name 'Migration.md' -print0 | xargs -0 sed -i "s ${DEP_LIB}${DEP_PREV_VER} ${DEP_LIB}${DEP_VER} g" - - # Second run with _ instead of -, to support multiple variations of fuel-tools - DEP_LIB=${DEP_LIB//-/_} - find . -type f ! -name 'Changelog.md' ! -name 'Migration.md' -print0 | xargs -0 sed -i "s ${DEP_LIB}${DEP_PREV_VER} ${DEP_LIB}${DEP_VER} g" - - # Replace collection yaml branch names with main - if [[ "${LIB}" == "ign-${COLLECTION}" ]]; then - find . -type f -name "collection-${COLLECTION}.yaml" -print0 | xargs -0 sed -i "s ign-${DEP_LIB}${DEP_VER} main g" - fi - done - - commitAndPR ${ORG} main - ################## # release repo ################## @@ -384,7 +345,7 @@ for ((i = 0; i < "${#LIBRARIES[@]}"; i++)); do echo -e "${GREEN}${LIB}: homebrew${DEFAULT}" cd ${TEMP_DIR}/homebrew-simulation - startFromCleanBranch bump_${COLLECTION}_${LIB} master + startFromCleanBranch ${BUMP_BRANCH} master # expand ign-* to ignition-* FORMULA_BASE=${LIB/ign/ignition} @@ -469,6 +430,45 @@ for ((i = 0; i < "${#LIBRARIES[@]}"; i++)); do commitAndPR ${TOOLING_ORG} master + ################## + # source code + ################## + + echo -e "${GREEN}${LIB}: source code${DEFAULT}" + + cloneIfNeeded ${ORG} ${LIB} + startFromCleanBranch ${BUMP_BRANCH} main + + # Check if main branch of that library is the correct version + PROJECT_NAME="${LIB_}${VER}" + PROJECT_NAME="${PROJECT_NAME/ign_/ignition-}" + PROJECT="project.*(${PROJECT_NAME}" + if ! grep -q ${PROJECT} "CMakeLists.txt"; then + echo -e "${RED}Wrong project name on [CMakeLists.txt], looking for [$PROJECT_NAME].${DEFAULT}" + exit + fi + + echo -e "${GREEN}${LIB}: Updating source code${DEFAULT}" + for ((j = 0; j < "${#LIBRARIES[@]}"; j++)); do + + DEP_LIB=${LIBRARIES[$j]#"ign-"} + DEP_VER=${VERSIONS[$j]} + DEP_PREV_VER="$((${DEP_VER}-1))" + + find . -type f ! -name 'Changelog.md' ! -name 'Migration.md' -print0 | xargs -0 sed -i "s ${DEP_LIB}${DEP_PREV_VER} ${DEP_LIB}${DEP_VER} g" + + # Replace collection yaml branch names with main + if [[ "${LIB}" == "ign-${COLLECTION}" ]]; then + find . -type f -name "collection-${COLLECTION}.yaml" -print0 | xargs -0 sed -i "s ign-${DEP_LIB}${DEP_VER} main g" + fi + + # Second run with _ instead of -, to support multiple variations of fuel-tools + DEP_LIB=${DEP_LIB//-/_} + find . -type f ! -name 'Changelog.md' ! -name 'Migration.md' -print0 | xargs -0 sed -i "s ${DEP_LIB}${DEP_PREV_VER} ${DEP_LIB}${DEP_VER} g" + done + + commitAndPR ${ORG} main + # Collection ends here if ! [[ $VER == ?(-)+([0-9]) ]] ; then continue