Change build.sh script to point to Helm 2 compatible version of Fabrikate (#1451)

* Change get_fab_version functionality to find the latest version of the supplied Major version.

* Add v prefix to fabrikate major version

* Remove v from major version
This commit is contained in:
Andrew Doing 2020-11-02 13:22:07 -08:00 коммит произвёл GitHub
Родитель a2ef0541d7
Коммит ce52a2e29f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -28,13 +28,21 @@ function helm_init() {
}
# Obtain version for Fabrikate
# If the version number is not provided, then download the latest
# If the version number is not provided, then download the latest Helm2 compatible version
# The Major version number can be provided as the first argument,
function get_fab_version() {
# shellcheck disable=SC2153
if [ -z "$VERSION" ]
then
# By default, the script will use the most recent non-prerelease, non-draft release Fabrikate
VERSION_TO_DOWNLOAD=$(curl -s "https://api.github.com/repos/microsoft/fabrikate/releases/latest" | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1/')
# By default, the script will use the Helm 2 compatible, non-prerelease, non-draft release Fabrikate.
MAJOR=${1:-0}
VERSIONS=$(curl -s "https://api.github.com/repos/microsoft/fabrikate/git/matching-refs/tags/$MAJOR" | grep "/refs/tags/$MAJOR" | while read -r line ; do
VERSION=${line##*/}
VERSION=${VERSION%\",}
echo "$VERSION"
done | sort -V)
VERSION_TO_DOWNLOAD=${VERSIONS##*$'\n'}
echo $VERSION_TO_DOWNLOAD
else
echo "Fabrikate Version: $VERSION"
VERSION_TO_DOWNLOAD=$VERSION