Use --version-sort instead of -n for role version bump

Using sort -n can mean that version x.9 is taken above version x.13 due
to how the sort will happen.

It is a better approach to adopt sort --version-sort

Change-Id: Ied5a2206f5d86838f2b0e083b11f9a063c5a1f63
This commit is contained in:
Andy McCrae 2018-07-12 17:00:02 +01:00
parent 4613c2d070
commit 0afba09330
1 changed files with 1 additions and 1 deletions

View File

@ -248,7 +248,7 @@ update_ansible_role_requirements() {
# If the role_src is NOT from git.openstack.org, try to get a tag first unless we are working on master
if [[ ${role_src} != *"git.openstack.org"* ]] && [[ "${force_master}" != "true" ]]; then
role_version=$(git ls-remote --tags ${role_src} | awk '{print $2}' | grep -v '{}' | cut -d/ -f 3 | sort -n | tail -n 1)
role_version=$(git ls-remote --tags ${role_src} | awk '{print $2}' | grep -v '{}' | cut -d/ -f 3 | sort --version-sort | tail -n 1)
fi
# Grab the latest SHA that matches the specified branch