Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

ci: sidecar images updates will be also created for latest bugfix branch #434

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/sidecar-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ jobs:
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "[email protected]"
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }}
./arbitrary-users-patch/check_sidecar_image_digests.sh
BUGFIX_BRANCH="$(git branch -a | grep "remotes/origin/7.*" | cut -d '/' -f 3 | sort --version-sort | tail -n1)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if a topic branch is created called 7.32.x-some-reason? will that be used instead of 7.32.x ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I should add protection from that

./arbitrary-users-patch/check_sidecar_image_digests.sh --bugfix-branch ${BUGFIX_BRANCH}
17 changes: 15 additions & 2 deletions arbitrary-users-patch/check_sidecar_image_digests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
set -e

NO_OP="false"
BUGFIX_BRANCH=""
while [[ "$#" -gt 0 ]]; do
case $1 in
'-n'|'--no-op') NO_OP="true"; shift 0;;
'-bb'|'--bugfix-branch') BUGFIX_BRANCH=$2; shift 1;;
esac
shift 1
done
Expand All @@ -36,18 +38,28 @@ createPR() {
set +e
PR_BRANCH="$1"

COMMIT_MSG="[update] Update digests in base_images"
COMMIT_MSG="chore: Update digests in base_images"
nickboldt marked this conversation as resolved.
Show resolved Hide resolved

# commit change into branch
git add "${SCRIPT_DIR}"/base_images
git commit -sm "${COMMIT_MSG}"

git branch "${PR_BRANCH}"
git checkout "${PR_BRANCH}"
git checkout "${PR_BRANCH}"
git pull origin "${PR_BRANCH}"
git push origin "${PR_BRANCH}"
lastCommitComment="$(git log -1 --pretty=%B)"

hub pull-request -f -m "${lastCommitComment}" -b "${MAIN_BRANCH}" -h "${PR_BRANCH}"

if [[ -n ${BUGFIX_BRANCH} ]]; then
lastCommitId="$(git log --format=\"%H\" -n 1)"
git checkout "${BUGFIX_BRANCH}"
git branch "${PR_BRANCH}-bugfix-branch"
git checkout "${PR_BRANCH}-bugfix-branch"
git cherry-pick "${lastCommitId}"
hub pull-request -f -m "${lastCommitComment}" -b "${MAIN_BRANCH}" -h "${PR_BRANCH}-bugfix-branch"
fi
set -e
}

Expand Down Expand Up @@ -77,6 +89,7 @@ if [[ $(git diff --exit-code "${SCRIPT_DIR}"/base_images) ]]; then
else
echo "[INFO] Changes detected, generating PR with new digests"
createPR "new-base-image-digests"
create
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

fi
else
echo "[INFO] No changes detected for digests, do nothing"
Expand Down