From 6198737fad00c364c5d1c80b62f8b32ea9415a55 Mon Sep 17 00:00:00 2001 From: Lance Ball Date: Wed, 11 Oct 2023 09:52:03 -0400 Subject: [PATCH] chore: modify update script to avoid merge conflicts By simply overwriting the history for the release branch, the update script is prone to merge conflicts when updating the release branch. This change modifies the update script to consider the release branch as the canonical branch, merging it into the release-ci branch with each sync update. Signed-off-by: Lance Ball --- redhat/release/update-to-head.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/redhat/release/update-to-head.sh b/redhat/release/update-to-head.sh index 7ab506edd21..8529ed32ca3 100755 --- a/redhat/release/update-to-head.sh +++ b/redhat/release/update-to-head.sh @@ -53,11 +53,16 @@ robot_trigger_msg=":robot: triggering CI on branch '${redhat_ref}' after synchin # Reset release-next to upstream main or . git fetch upstream $upstream_ref if [[ "$upstream_ref" == "main" ]]; then - git checkout upstream/main -B ${redhat_ref} + git checkout upstream/main -B ${redhat_ref}-ci else - git checkout $upstream_ref -B ${redhat_ref} + git checkout $upstream_ref -B ${redhat_ref}-ci fi +# RHTAP writes its pipeline files to the root of ${redhat_ref} +# Fetch those from origin and merge them into the the ci branch +git fetch origin $redhat_ref +git merge origin/$redhat_ref --no-edit + # Update redhat's main and take all needed files from there. git fetch origin $midstream_ref git checkout origin/$midstream_ref $custom_files @@ -67,15 +72,9 @@ if [[ -d redhat/patches ]]; then git apply redhat/patches/* fi -# RHTAP writes its pipeline files to the root of ${redhat_ref} -# Fetch those from origin and apply them to the the release branch -# since we just wiped out our local copy with the upstream ref. -git fetch origin $redhat_ref -git checkout origin/$redhat_ref .tekton - # Move overlays to root if [[ -d redhat/overlays ]]; then - git mv redhat/overlays/* . + mv redhat/overlays/* . fi git add . # Adds applied patches @@ -83,8 +82,6 @@ git add $custom_files # Adds custom files git commit -m "${redhat_files_msg}" # Trigger CI -# TODO: Set up openshift or github CI to run on release-next-ci -git checkout "${redhat_ref}" -B "${redhat_ref}"-ci date > ci git add ci git commit -m "${robot_trigger_msg}"