From 356b446e5d46b273001b9a58febe93b9d64ab791 Mon Sep 17 00:00:00 2001 From: Lukasz Dziedziak Date: Tue, 26 Nov 2024 10:20:40 +0100 Subject: [PATCH] docs(DEVELOPMENT): added instruction about conflict resolution (#9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukasz Dziedziak Co-authored-by: Krzysztof SÅ‚onka --- .github/scripts/get-version-tags.sh | 17 ++++++--- DEVELOPMENT.md | 55 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/.github/scripts/get-version-tags.sh b/.github/scripts/get-version-tags.sh index 1e0a77d8b..611d40162 100755 --- a/.github/scripts/get-version-tags.sh +++ b/.github/scripts/get-version-tags.sh @@ -1,7 +1,7 @@ #!/bin/bash current_tag=$(git tag --list --merged origin/release --sort=-creatordate | head -n 1) -main_tag=$(git tag --list --merged main --sort=-creatordate | head -n 1) +main_tag=$(git tag --list --merged origin/main --sort=-creatordate | head -n 1) # Remove the prefix `v` and `-kong-*` suffix for comparison released_tag="${current_tag%-kong-*}" @@ -10,6 +10,16 @@ currentVersion="${released_tag#v}" # Main branch won't have -kong-* suffix newVersion="${main_tag#v}" +echo "Current release tag prefix: $released_tag" +echo "Upstream tag: $main_tag" +new_tag="${main_tag}-kong-1" +if [[ $current_tag != $new_tag ]]; then + echo "New tag: $new_tag" +else + echo "Tags are equal, no need to release" + exit 0 +fi + # Convert versions to arrays IFS='.' read -r -a currentParts <<< "$currentVersion" IFS='.' read -r -a newParts <<< "$newVersion" @@ -24,9 +34,8 @@ echo "Upstream tag: $newVersion" for i in 0 1 2; do if [[ ${newParts[i]:-0} -gt ${currentParts[i]:-0} ]]; then echo "The new tag is higher." - newVersionTag="${main_tag}-kong-1" - echo "New version tag: $newVersionTag" - echo "new_tag=$newVersionTag" >> $GITHUB_OUTPUT + echo "New version tag: $new_tag" + echo "new_tag=$new_tag" >> $GITHUB_OUTPUT exit 0 elif [[ ${newParts[i]:-0} -lt ${currentParts[i]:-0} ]]; then echo "The current tag is higher. That shouldn't be that case, please fix tagging." diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 86486562c..ddbf54e2e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -30,3 +30,58 @@ The current tag is `v0.13.1-kong-1`. After merging your changes, you want to rel `v0.13.1-kong-2` After tagging, push the commit to the repository to finalize the release. + +## Conflict resolution + +It might happen that automatic release job can hit a conflict. In this situation maintainer needs to resolve this manually: + +Instruction + +1. Fetch current `main` and `release` branch +```bash +git fetch origin --tags +``` +2. Update current main branch with origin +```bash +git reset --hard origin/main +``` +3. Change to the release branch +```bash +git checkout release +git reset --hard origin/release +``` +4. Remove Untracked Files and Directories +```bash +git clean -fd +``` +5. Get new tag value +```bash +./.github/scripts/get-version-tags.sh +``` + +Output: +```bash +Current release tag prefix: v0.13.1 +Upstream tag: v0.13.2 +New tag: v0.13.2-kong-1 +``` + +if tags are equal, you are going to see message `"Tags are equal, no need to release"` and you don't need to release/rebase anything. + +6. Rebase release branch between tags: +```bash +git rebase --onto release +``` +7. If you encounter git conflicts, resolve them, and follow git instruction +* resolve conflicts +* git add +* git rebase --continue + +8. Tag the commit +```bash +git tag +``` +9. Push changes to origin +```bash +git push origin release --tags --force-with-lease +```