Skip to content

Commit

Permalink
chore: modify update script to avoid merge conflicts
Browse files Browse the repository at this point in the history
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 <lball@redhat.com>
  • Loading branch information
lance committed Oct 11, 2023
1 parent 3447abc commit 6198737
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions redhat/release/update-to-head.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ robot_trigger_msg=":robot: triggering CI on branch '${redhat_ref}' after synchin
# Reset release-next to upstream main or <git-ref>.
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
Expand All @@ -67,24 +72,16 @@ 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
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}"
Expand Down

0 comments on commit 6198737

Please sign in to comment.