mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* create/update config.json using go generate * added default config generator added config-reset to Jenkins and make package, updated defaults to consider 'isNew' flag * corrections after code review * fixed Config.isValid to handle empty encryption keys * fixed Config.isValid to handle empty encryption keys * fixed Config.isValid to handle empty encryption keys * isUpdate now only checks for nil * Addressed review comments, added unit testing for default config generator * err shadowing * license * provide output file for config generator via ENV variable, since go generate doesn't support arguments and we need two output paths (config-reset and package) * cleanup * proper defaults for PushNotificationServer and SendPushNotifications * corrected generating defaults for TrustedProxyIPHeader to be consistent with default.json in master * Check for empty SiteURL as well as nil * corrected SiteURL settings and checking * crazy typos fixed * corrected tests to newly expected values * relaxed the checks * fixed formatting
133 lines
5.2 KiB
Makefile
133 lines
5.2 KiB
Makefile
|
|
dist: | check-style test package
|
|
|
|
build-linux:
|
|
@echo Build Linux amd64
|
|
env GOOS=linux GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
|
|
|
build-osx:
|
|
@echo Build OSX amd64
|
|
env GOOS=darwin GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
|
|
|
build-windows:
|
|
@echo Build Windows amd64
|
|
env GOOS=windows GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
|
|
|
build: build-linux build-windows build-osx
|
|
|
|
build-client:
|
|
@echo Building mattermost web app
|
|
|
|
cd $(BUILD_WEBAPP_DIR) && $(MAKE) build
|
|
|
|
package:
|
|
@ echo Packaging mattermost
|
|
|
|
@# Remove any old files
|
|
rm -Rf $(DIST_ROOT)
|
|
|
|
@# Create needed directories
|
|
mkdir -p $(DIST_PATH)/bin
|
|
mkdir -p $(DIST_PATH)/logs
|
|
mkdir -p $(DIST_PATH)/prepackaged_plugins
|
|
|
|
@# Resource directories
|
|
mkdir -p $(DIST_PATH)/config
|
|
cp -L config/README.md $(DIST_PATH)/config
|
|
OUTPUT_CONFIG=$(PWD)/$(DIST_PATH)/config/config.json go generate ./config
|
|
cp -RL fonts $(DIST_PATH)
|
|
cp -RL templates $(DIST_PATH)
|
|
cp -RL i18n $(DIST_PATH)
|
|
|
|
@# Disable developer settings
|
|
sed -i'' -e 's|"ConsoleLevel": "DEBUG"|"ConsoleLevel": "INFO"|g' $(DIST_PATH)/config/config.json
|
|
sed -i'' -e 's|"SiteURL": "http://localhost:8065"|"SiteURL": ""|g' $(DIST_PATH)/config/config.json
|
|
|
|
@# Reset email sending to original configuration
|
|
sed -i'' -e 's|"SendEmailNotifications": true,|"SendEmailNotifications": false,|g' $(DIST_PATH)/config/config.json
|
|
sed -i'' -e 's|"FeedbackEmail": "test@example.com",|"FeedbackEmail": "",|g' $(DIST_PATH)/config/config.json
|
|
sed -i'' -e 's|"ReplyToAddress": "test@example.com",|"ReplyToAddress": "",|g' $(DIST_PATH)/config/config.json
|
|
sed -i'' -e 's|"SMTPServer": "dockerhost",|"SMTPServer": "",|g' $(DIST_PATH)/config/config.json
|
|
sed -i'' -e 's|"SMTPPort": "2500",|"SMTPPort": "",|g' $(DIST_PATH)/config/config.json
|
|
|
|
@# Package webapp
|
|
mkdir -p $(DIST_PATH)/client
|
|
cp -RL $(BUILD_WEBAPP_DIR)/dist/* $(DIST_PATH)/client
|
|
|
|
@# Help files
|
|
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
|
cp $(BUILD_ENTERPRISE_DIR)/ENTERPRISE-EDITION-LICENSE.txt $(DIST_PATH)
|
|
else
|
|
cp build/MIT-COMPILED-LICENSE.md $(DIST_PATH)
|
|
endif
|
|
cp NOTICE.txt $(DIST_PATH)
|
|
cp README.md $(DIST_PATH)
|
|
|
|
@# Download prepackaged plugins
|
|
mkdir -p tmpprepackaged
|
|
@cd tmpprepackaged && for plugin_package in $(PLUGIN_PACKAGES) ; do \
|
|
curl -O -L https://plugins-store.test.mattermost.com/release/$$plugin_package.tar.gz; \
|
|
done
|
|
|
|
@# ----- PLATFORM SPECIFIC -----
|
|
|
|
@# Make osx package
|
|
@# Copy binary
|
|
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
|
|
cp $(GOPATH)/bin/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
else
|
|
cp $(GOPATH)/bin/darwin_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
cp $(GOPATH)/bin/darwin_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
endif
|
|
@# Strip and prepackage plugins
|
|
@for plugin_package in $(PLUGIN_PACKAGES) ; do \
|
|
cat tmpprepackaged/$$plugin_package.tar.gz | gunzip | tar --wildcards --delete "*windows*" --delete "*linux*" | gzip > $(DIST_PATH)/prepackaged_plugins/$$plugin_package.tar.gz; \
|
|
done
|
|
@# Package
|
|
tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-osx-amd64.tar.gz mattermost
|
|
@# Cleanup
|
|
rm -f $(DIST_PATH)/bin/mattermost
|
|
rm -f $(DIST_PATH)/bin/platform
|
|
rm -f $(DIST_PATH)/prepackaged_plugins/*
|
|
|
|
@# Make windows package
|
|
@# Copy binary
|
|
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
|
|
cp $(GOPATH)/bin/mattermost.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
cp $(GOPATH)/bin/platform.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
else
|
|
cp $(GOPATH)/bin/windows_amd64/mattermost.exe $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
cp $(GOPATH)/bin/windows_amd64/platform.exe $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
endif
|
|
@# Strip and prepackage plugins
|
|
@for plugin_package in $(PLUGIN_PACKAGES) ; do \
|
|
cat tmpprepackaged/$$plugin_package.tar.gz | gunzip | tar --wildcards --delete "*darwin*" --delete "*linux*" | gzip > $(DIST_PATH)/prepackaged_plugins/$$plugin_package.tar.gz; \
|
|
done
|
|
@# Package
|
|
cd $(DIST_ROOT) && zip -9 -r -q -l mattermost-$(BUILD_TYPE_NAME)-windows-amd64.zip mattermost && cd ..
|
|
@# Cleanup
|
|
rm -f $(DIST_PATH)/bin/mattermost.exe
|
|
rm -f $(DIST_PATH)/bin/platform.exe
|
|
rm -f $(DIST_PATH)/prepackaged_plugins/*
|
|
|
|
@# Make linux package
|
|
@# Copy binary
|
|
ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
|
|
cp $(GOPATH)/bin/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
else
|
|
cp $(GOPATH)/bin/linux_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
cp $(GOPATH)/bin/linux_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
endif
|
|
@# Strip and prepackage plugins
|
|
@for plugin_package in $(PLUGIN_PACKAGES) ; do \
|
|
cat tmpprepackaged/$$plugin_package.tar.gz | gunzip | tar --wildcards --delete "*windows*" --delete "*darwin*" | gzip > $(DIST_PATH)/prepackaged_plugins/$$plugin_package.tar.gz; \
|
|
done
|
|
@# Package
|
|
tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-linux-amd64.tar.gz mattermost
|
|
@# Don't clean up native package so dev machines will have an unzipped package available
|
|
@#rm -f $(DIST_PATH)/bin/mattermost
|
|
|
|
rm -rf tmpprepackaged
|