Adding curl as option to 'make deploy' for better linux support
This commit is contained in:
parent
41037d02e1
commit
376d9f5cd0
1 changed files with 10 additions and 1 deletions
11
Makefile
11
Makefile
|
@ -1,6 +1,8 @@
|
||||||
GO ?= $(shell command -v go 2> /dev/null)
|
GO ?= $(shell command -v go 2> /dev/null)
|
||||||
DEP ?= $(shell command -v dep 2> /dev/null)
|
DEP ?= $(shell command -v dep 2> /dev/null)
|
||||||
NPM ?= $(shell command -v npm 2> /dev/null)
|
NPM ?= $(shell command -v npm 2> /dev/null)
|
||||||
|
HTTP ?= $(shell command -v http 2> /dev/null)
|
||||||
|
CURL ?= $(shell command -v curl 2> /dev/null)
|
||||||
MANIFEST_FILE ?= plugin.json
|
MANIFEST_FILE ?= plugin.json
|
||||||
|
|
||||||
# Verify environment, and define PLUGIN_ID, HAS_SERVER and HAS_WEBAPP as needed.
|
# Verify environment, and define PLUGIN_ID, HAS_SERVER and HAS_WEBAPP as needed.
|
||||||
|
@ -74,7 +76,7 @@ dist: apply \
|
||||||
# variables are defined, or copying the files directly to a sibling mattermost-server directory
|
# variables are defined, or copying the files directly to a sibling mattermost-server directory
|
||||||
.PHONY: deploy
|
.PHONY: deploy
|
||||||
deploy: dist
|
deploy: dist
|
||||||
ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSWORD)),)
|
ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSWORD),$(HTTP)),)
|
||||||
@echo "Installing plugin via API"
|
@echo "Installing plugin via API"
|
||||||
(TOKEN=`http --print h POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login login_id=$(MM_ADMIN_USERNAME) password=$(MM_ADMIN_PASSWORD) | grep Token | cut -f2 -d' '` && \
|
(TOKEN=`http --print h POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login login_id=$(MM_ADMIN_USERNAME) password=$(MM_ADMIN_PASSWORD) | grep Token | cut -f2 -d' '` && \
|
||||||
http --print b GET $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/me Authorization:"Bearer $$TOKEN" && \
|
http --print b GET $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/me Authorization:"Bearer $$TOKEN" && \
|
||||||
|
@ -83,6 +85,13 @@ ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSW
|
||||||
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable Authorization:"Bearer $$TOKEN" && \
|
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable Authorization:"Bearer $$TOKEN" && \
|
||||||
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/logout Authorization:"Bearer $$TOKEN" \
|
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/logout Authorization:"Bearer $$TOKEN" \
|
||||||
)
|
)
|
||||||
|
else ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSWORD),$(CURL)),)
|
||||||
|
@echo "Installing plugin via API"
|
||||||
|
$(eval TOKEN := $(shell curl -i -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login -d '{"login_id": "$(MM_ADMIN_USERNAME)", "password": "$(MM_ADMIN_PASSWORD)"}' | grep Token | cut -f2 -d' ' 2> /dev/null))
|
||||||
|
@curl -s -H "Authorization: Bearer $(TOKEN)" -X DELETE $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID) > /dev/null
|
||||||
|
@curl -s -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins -F "plugin=@dist/$(PLUGIN_ID).tar.gz" > /dev/null && \
|
||||||
|
curl -s -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable > /dev/null && \
|
||||||
|
echo "OK." || echo "Sorry, something went wrong."
|
||||||
else ifneq ($(wildcard ../mattermost-server/.*),)
|
else ifneq ($(wildcard ../mattermost-server/.*),)
|
||||||
@echo "Installing plugin via filesystem. Server restart and manual plugin enabling required"
|
@echo "Installing plugin via filesystem. Server restart and manual plugin enabling required"
|
||||||
mkdir -p ../mattermost-server/plugins
|
mkdir -p ../mattermost-server/plugins
|
||||||
|
|
Reference in a new issue