[MM-28303]: check if mmctl exists before checking on Github and reduce requests to Github (#15387)
Summary: Every make call would ping Github to find out the mmctl version to download. Each check made 4 requests to Github. So every make execution resulted in 4 requests to Github. This leads to frequent rate-limit errors from Github. In this PR we check for the mmctl version only if mmctl doesn't already exist. We also print a more helpful error message. Reduce the number the number of requests to Github from 4 to 2. Ticket Link: https://mattermost.atlassian.net/browse/MM-28303
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
605f96fbea
Коммит
ee76ad435b
26
Makefile
26
Makefile
@@ -124,9 +124,6 @@ else
|
||||
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-')
|
||||
|
||||
all: run ## Alias for 'run'.
|
||||
|
||||
-include config.override.mk
|
||||
@@ -198,24 +195,15 @@ prepackaged-plugins: ## Populate the prepackaged-plugins directory
|
||||
done
|
||||
|
||||
prepackaged-binaries: ## Populate the prepackaged-binaries to the bin directory
|
||||
ifeq ($(MMCTL_REL_TO_DOWNLOAD),)
|
||||
@echo "An error has occured trying to get the latest mmctl release. Aborting. Perhaps api.github.com is down?"
|
||||
@exit 1
|
||||
endif
|
||||
# Externally built binaries
|
||||
ifeq ($(shell test -f bin/mmctl && printf "yes"),yes)
|
||||
@echo mmctl installed
|
||||
else ifeq ($(PLATFORM),Darwin)
|
||||
@echo Downloading prepackaged binary: https://github.com/mattermost/mmctl/releases/$(MMCTL_REL_TO_DOWNLOAD)
|
||||
@MMCTL_FILE="darwin_amd64.tar" && curl -f -O -L https://github.com/mattermost/mmctl/releases/download/$(MMCTL_REL_TO_DOWNLOAD)/$$MMCTL_FILE && tar -xvf $$MMCTL_FILE -C bin && rm $$MMCTL_FILE
|
||||
else ifeq ($(PLATFORM),Linux)
|
||||
@echo Downloading prepackaged binary: https://github.com/mattermost/mmctl/releases/$(MMCTL_REL_TO_DOWNLOAD)
|
||||
@MMCTL_FILE="linux_amd64.tar" && curl -f -O -L https://github.com/mattermost/mmctl/releases/download/$(MMCTL_REL_TO_DOWNLOAD)/$$MMCTL_FILE && tar -xvf $$MMCTL_FILE -C bin && rm $$MMCTL_FILE
|
||||
else ifeq ($(PLATFORM),Windows)
|
||||
@echo Downloading prepackaged binary: https://github.com/mattermost/mmctl/releases/$(MMCTL_REL_TO_DOWNLOAD)
|
||||
@MMCTL_FILE="windows_amd64.zip" && curl -f -O -L https://github.com/mattermost/mmctl/releases/download/$(MMCTL_REL_TO_DOWNLOAD)/$$MMCTL_FILE && unzip -o $$MMCTL_FILE -d bin && rm $$MMCTL_FILE
|
||||
@echo "mmctl already exists in bin/mmctl not downloading a new version."
|
||||
else
|
||||
@echo "mmctl error: can't detect OS"
|
||||
@MMCTL_VERSION=$$(scripts/get_latest_release.sh mattermost/mmctl release-); if [ $$? -eq 0 ]; then \
|
||||
scripts/download_mmctl_release.sh $$MMCTL_VERSION; \
|
||||
else \
|
||||
echo $$MMCTL_VERSION; \
|
||||
exit 1; \
|
||||
fi;
|
||||
endif
|
||||
|
||||
golangci-lint: ## Run golangci-lint on codebase
|
||||
|
||||
Ссылка в новой задаче
Block a user