diff --git a/compatibility/get_last_tags.sh b/compatibility/get_last_tags.sh new file mode 100644 index 000000000..9da09f9aa --- /dev/null +++ b/compatibility/get_last_tags.sh @@ -0,0 +1,20 @@ +# update tags +git fetch --tags + +getLatestTags() { + release_5_branch_regex="^release-5\.[0-9].*$" + release_4_branch_regex="^release-4\.[0-9].*$" + TOTAL_TAGS=$(git for-each-ref --sort=creatordate refs/tags | awk -F '/' '{print $3}') + filter='alpha' + # latest tags + TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | grep -v $filter | tail -n3) + if git rev-parse --abbrev-ref HEAD | egrep -q $release_5_branch_regex + then + # If we are in release-5.0 branch, try to use latest 3 version of 5.x and last 4.x version + TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | grep -v $filter | tail -n1 && echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v5." | grep -v $filter | tail -n3) + elif git rev-parse --abbrev-ref HEAD | egrep -q $release_4_branch_regex + then + # If we are in release-4.0 branch, try to use latest 3 version of 4.x + TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | grep -v $filter | tail -n3) + fi +} \ No newline at end of file diff --git a/compatibility/prepare_backup.sh b/compatibility/prepare_backup.sh index 73c8df466..56eab1949 100644 --- a/compatibility/prepare_backup.sh +++ b/compatibility/prepare_backup.sh @@ -15,27 +15,9 @@ set -eux -# update tags -git fetch --tags +. compatibility/get_last_tags.sh TAGS="v5.0.0" -getLatestTags() { - release_5_branch_regex="^release-5\.[0-9].*$" - release_4_branch_regex="^release-4\.[0-9].*$" - TOTAL_TAGS=$(git for-each-ref --sort=creatordate refs/tags | awk -F '/' '{print $3}') - # latest tags - TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | tail -n3) - if git rev-parse --abbrev-ref HEAD | egrep -q $release_5_branch_regex - then - # If we are in release-5.0 branch, try to use latest 3 version of 5.x and last 4.x version - TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | tail -n1 && echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v5." | tail -n3) - elif git rev-parse --abbrev-ref HEAD | egrep -q $release_4_branch_regex - then - # If we are in release-4.0 branch, try to use latest 3 version of 4.x - TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | tail -n3) - fi -} - getLatestTags echo "recent version of cluster is $TAGS" diff --git a/tests/run_compatible.sh b/tests/run_compatible.sh index 98086fa23..9fcb2446c 100755 --- a/tests/run_compatible.sh +++ b/tests/run_compatible.sh @@ -19,7 +19,8 @@ set -eu -source ${BASH_SOURCE[0]%/*}/../compatibility/prepare_backup.sh +source ${BASH_SOURCE[0]%/*}/../compatibility/get_last_tags.sh +getLatestTags echo "start test on $TAGS" EXPECTED_KVS=1000