Updating the mmctl process to set the value once and than use it. Also added the basic auth code from agniva

This commit is contained in:
Jason Deland
2020-09-02 18:32:10 -04:00
parent 1be5512655
commit 953899ad95
2 changed files with 3 additions and 3 deletions

View File

@@ -115,7 +115,7 @@ ALL_PACKAGES=$(TE_PACKAGES)
endif
# Decide what version of prebuilt binaries to download. This will use the release-* branch names or change to the latest.
MMCTL_REL_TO_DOWNLOAD = $(shell scripts/get_latest_release.sh 'mattermost/mmctl' 'release-')
MMCTL_REL_TO_DOWNLOAD:=$(shell scripts/get_latest_release.sh 'mattermost/mmctl' 'release-')
all: run ## Alias for 'run'.

View File

@@ -12,7 +12,7 @@ BASIC_AUTH=""
# If we find a github username and token, we use that.
# In CI, these variables are available and useful to avoid rate limits which is
# much more strict for unauthenticated requests.
if [[ $GITHUB_USERNAME != "" && $GITHUB_TOKEN != "" ]];
if [[ ! -z "$GITHUB_USERNAME" && ! -z "$GITHUB_TOKEN" ]];
then
BASIC_AUTH="--user $GITHUB_USERNAME:$GITHUB_TOKEN"
fi
@@ -44,7 +44,7 @@ if [[ "$THIS_BRANCH" =~ $BRANCH_TO_USE || $DRAFT =~ "true" ]]; then
REL_TO_USE=$(curl --silent $BASIC_AUTH "https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -n "/$VERSION_REL/p" | sort -rV | head -n 1)
elif [[ "$THIS_BRANCH" =~ "master" ]]; then
# Get the latest release even if its a pre-release
REL_TO_USE=$(curl --silent $BASIC_AUTH" https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sort -rV | head -n 1)
REL_TO_USE=$(curl --silent $BASIC_AUTH "https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sort -rV | head -n 1)
else
REL_TO_USE=$LATEST_REL
fi