2024-09-19 04:00:56 -04:00
.PHONY : build package run stop run -client run -server run -node run -haserver stop -haserver stop -client stop -server restart restart -server restart -client restart -haserver start -docker update -docker clean -dist clean nuke check -style check -client -style check -server -style check -unit -tests test dist run -client -tests setup -run -client -tests cleanup -run -client -tests test -client build -linux build -osx build -windows package -prep package -linux package -osx package -windows internal -test -web -client vet run -server -for -web -client -tests diff -config prepackaged -plugins prepackaged -binaries test -server test -server -ee test -server -quick test -server -race test -mmctl -unit test -mmctl -e 2e test -mmctl test -mmctl -coverage mmctl -build mmctl -docs new -migration migrations -extract test -public mocks -public
2015-06-15 03:53:32 -04:00
2017-10-12 11:35:19 -04:00
ROOT := $( dir $( abspath $( lastword $( MAKEFILE_LIST) ) ) )
2020-02-03 16:58:15 -05:00
i f e q ( $( OS ) , W i n d o w s _ N T )
PLATFORM := Windows
e l s e
PLATFORM := $( shell uname)
e n d i f
2023-12-02 07:20:15 -05:00
# Detect Apple Silicon and set a flag.
2022-06-17 07:42:56 -04:00
i f e q ( $( shell uname ) / $( shell uname -m ) , D a r w i n / a r m 6 4 )
2023-12-02 07:20:15 -05:00
ARM_BASED_MAC = true
2022-06-17 07:42:56 -04:00
e n d i f
2022-01-07 09:32:54 -05:00
d e f i n e L I C E N S E _ H E A D E R
/ / C o p y r i g h t ( c ) 2 0 1 5 - p r e s e n t M a t t e r m o s t , I n c . A l l R i g h t s R e s e r v e d .
/ / S e e L I C E N S E . t x t f o r l i c e n s e i n f o r m a t i o n .
e n d e f
2018-12-10 11:58:09 -05:00
IS_CI ?= false
2016-03-18 12:46:57 -04:00
# Build Flags
2015-06-15 03:53:32 -04:00
BUILD_NUMBER ?= $( BUILD_NUMBER:)
2015-09-16 20:45:00 -04:00
BUILD_DATE = $( shell date -u)
2015-09-17 16:01:40 -04:00
BUILD_HASH = $( shell git rev-parse HEAD)
2024-01-08 09:47:24 -05:00
BUILD_TAGS =
2023-03-08 10:14:14 -05:00
2023-06-05 06:42:55 -04:00
2023-03-22 17:22:27 -04:00
# Docker
export COMPOSE_PROJECT_NAME = mattermost-server
2016-03-18 12:46:57 -04:00
# If we don't set the build number it defaults to dev
2015-06-15 03:53:32 -04:00
i f e q ( $( BUILD_NUMBER ) , )
2021-09-15 04:16:20 -04:00
BUILD_DATE := n/a
2015-06-15 03:53:32 -04:00
BUILD_NUMBER := dev
e n d i f
2022-06-23 07:55:50 -04:00
2023-06-15 14:27:52 -04:00
# Go test sum configuration
GOTESTSUM_FORMAT ?= testname
GOTESTSUM_JUNITFILE ?= report.xml
GOTESTSUM_JSONFILE ?= gotestsum.json
2025-05-30 07:58:26 -04:00
# Go test coverage
ENABLE_COVERAGE ?= false
i f e q ( $( ENABLE_COVERAGE ) , t r u e )
COVERAGE_FLAG = -coverprofile= cover.out -covermode= atomic
e n d i f
2023-06-05 06:42:55 -04:00
# mmctl
MMCTL_BUILD_TAGS =
2023-10-06 09:43:06 -04:00
MMCTL_TESTFLAGS ?= -timeout 30m
2023-06-11 01:24:35 -04:00
MMCTL_PKG = github.com/mattermost/mattermost/server/v8/cmd/mmctl/commands
2023-10-20 05:23:05 -04:00
MMCTL_BUILD_DATE = $( shell date -u +'%Y-%m-%dT%H:%M:%SZ' )
MMCTL_LDFLAGS += -X " $( MMCTL_PKG) .buildDate= $( MMCTL_BUILD_DATE) "
2023-06-05 06:42:55 -04:00
2022-06-23 07:55:50 -04:00
# Enterprise
2023-03-22 17:22:27 -04:00
BUILD_ENTERPRISE_DIR ?= ../../enterprise
2016-03-18 12:46:57 -04:00
BUILD_ENTERPRISE ?= true
BUILD_ENTERPRISE_READY = false
2016-04-06 09:33:33 -04:00
BUILD_TYPE_NAME = team
2016-05-20 10:41:47 -04:00
BUILD_HASH_ENTERPRISE = none
2016-03-18 12:46:57 -04:00
i f n e q ( $( wildcard $ ( BUILD_ENTERPRISE_DIR ) /.) , )
2023-06-11 01:24:35 -04:00
MMCTL_TESTFLAGS += -ldflags '-X "$(MMCTL_PKG).EnableEnterpriseTests=true" -X "github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady=true"'
2023-06-05 06:42:55 -04:00
MMCTL_BUILD_TAGS += enterprise
2022-06-09 05:45:17 -04:00
ifeq ( $( BUILD_ENTERPRISE) ,true)
BUILD_ENTERPRISE_READY = true
BUILD_TYPE_NAME = enterprise
BUILD_HASH_ENTERPRISE = $( shell cd $( BUILD_ENTERPRISE_DIR) && git rev-parse HEAD)
2024-01-08 09:47:24 -05:00
BUILD_TAGS += enterprise
2022-06-09 05:45:17 -04:00
else
BUILD_ENTERPRISE_READY = false
BUILD_TYPE_NAME = team
endif
2015-07-30 03:55:45 -04:00
e l s e
2016-03-18 12:46:57 -04:00
BUILD_ENTERPRISE_READY = false
2016-04-06 09:33:33 -04:00
BUILD_TYPE_NAME = team
2015-07-30 03:55:45 -04:00
e n d i f
2022-06-23 07:55:50 -04:00
MM-64878: FIPS Build (#33809)
* pin to ubuntu-24.04
* always use FIPS compatible Postgres settings
* use sha256 for remote cluster IDs
* use sha256 for client config hash
* rework S3 backend to be FIPS compatible
* skip setup-node during build, since already in container
* support FIPS builds
* Dockerfile for FIPS image, using glibc-openssl-fips
* workaround entrypoint inconsistencies
* authenticate to DockerHub
* fix FIPS_ENABLED, add test-mmctl-fips
* decouple check-mattermost-vet from test/build steps
* fixup! decouple check-mattermost-vet from test/build steps
* only build-linux-amd64 for fips
* rm entrypoint workaround
* tweak comment grammar
* rm unused Dockerfile.fips (for now)
* ignore gpg import errors, since would fail later anyway
* for fips, only make package-linux-amd64
* set FIPS_ENABLED for build step
* Add a FIPS-specific list of prepackaged plugins
Note that the names are still temporary, since they are not uploaded to
S3 yet. We may need to tweak them when that happens.
* s/golangci-lint/check-style/
This ensures we run all the `check-style` checks: previously,
`modernize` was missing.
* pin go-vet to @v2, remove annoying comment
* add -fips to linux-amd64.tz.gz package
* rm unused setup-chainctl
* use BUILD_TYPE_NAME instead
* mv fips build to enterprise-only
* fixup! use BUILD_TYPE_NAME instead
* temporarily pre-package no plugins for FIPS
* split package-cleanup
* undo package-cleanup, just skip ARM, also test
* skip arm for FIPS in second target too
* fmt Makefile
* Revert "rm unused Dockerfile.fips (for now)"
This reverts commit 601e37e0fff7b7703540bb9e91961ad8bb83b2e7.
* reintroduce Dockerfile.fips and align with existing Dockerfile
* s/IMAGE/BUILD_IMAGE/
* bump the glibc-openssl-fips version
* rm redundant comment
* fix FIPS checks
* set PLUGIN_PACKAGES empty until prepackaged plugins ready
* upgrade glibc-openssl-fips, use non-dev version for final stage
* another BUILD_IMAGE case
* Prepackage the FIPS versions of plugins
* relocate FIPS_ENABLED initialization before use
* s/Config File MD5/Config File Hash/
* Update the FIPS plugin names and encode the + sign
* add /var/tmp for local socket manipulation
---------
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-09-15 09:53:28 -04:00
FIPS_ENABLED ?= false
i f e q ( $( FIPS_ENABLED ) , t r u e )
BUILD_TYPE_NAME := $( BUILD_TYPE_NAME) -fips
e n d i f
2024-01-08 09:47:24 -05:00
# Clean up the old means of importing enterprise source, if it exists
i f n e q ( $( wildcard channels /imports /imports .go ) , )
IGNORE := $( shell rm -f channels/imports/imports.go)
e n d i f
# Source available, already included with enterprise but also available during development.
i f e q ( $( BUILD_NUMBER ) , d e v )
BUILD_TAGS += sourceavailable
e n d i f
2022-06-23 07:55:50 -04:00
# Webapp
2023-03-22 17:22:27 -04:00
BUILD_WEBAPP_DIR ?= ../webapp
2015-07-30 03:55:45 -04:00
2021-04-01 13:44:56 -04:00
# We need current user's UID for `run-haserver` so docker compose does not run server
# as root and mess up file permissions for devs. When running like this HOME will be blank
2021-04-28 02:29:55 -04:00
# and docker will add '/', so we need to set the go-build cache location or we'll get
2021-04-01 13:44:56 -04:00
# permission errors on build as it tries to create a cache in filesystem root.
export CURRENT_UID = $( shell id -u) :$( shell id -g)
i f e q ( $( HOME ) , / )
export XDG_CACHE_HOME = /tmp/go-cache/
e n d i f
2020-01-21 07:49:49 -05:00
# Go Flags
2020-04-06 23:31:06 -04:00
GOFLAGS ?= $( GOFLAGS:)
2020-01-27 03:04:35 -05:00
# We need to export GOBIN to allow it to be set
# for processes spawned from the Makefile
export GOBIN ?= $( PWD) /bin
2023-12-14 03:58:11 -05:00
GO ?= go
MM-64878: FIPS Build (#33809)
* pin to ubuntu-24.04
* always use FIPS compatible Postgres settings
* use sha256 for remote cluster IDs
* use sha256 for client config hash
* rework S3 backend to be FIPS compatible
* skip setup-node during build, since already in container
* support FIPS builds
* Dockerfile for FIPS image, using glibc-openssl-fips
* workaround entrypoint inconsistencies
* authenticate to DockerHub
* fix FIPS_ENABLED, add test-mmctl-fips
* decouple check-mattermost-vet from test/build steps
* fixup! decouple check-mattermost-vet from test/build steps
* only build-linux-amd64 for fips
* rm entrypoint workaround
* tweak comment grammar
* rm unused Dockerfile.fips (for now)
* ignore gpg import errors, since would fail later anyway
* for fips, only make package-linux-amd64
* set FIPS_ENABLED for build step
* Add a FIPS-specific list of prepackaged plugins
Note that the names are still temporary, since they are not uploaded to
S3 yet. We may need to tweak them when that happens.
* s/golangci-lint/check-style/
This ensures we run all the `check-style` checks: previously,
`modernize` was missing.
* pin go-vet to @v2, remove annoying comment
* add -fips to linux-amd64.tz.gz package
* rm unused setup-chainctl
* use BUILD_TYPE_NAME instead
* mv fips build to enterprise-only
* fixup! use BUILD_TYPE_NAME instead
* temporarily pre-package no plugins for FIPS
* split package-cleanup
* undo package-cleanup, just skip ARM, also test
* skip arm for FIPS in second target too
* fmt Makefile
* Revert "rm unused Dockerfile.fips (for now)"
This reverts commit 601e37e0fff7b7703540bb9e91961ad8bb83b2e7.
* reintroduce Dockerfile.fips and align with existing Dockerfile
* s/IMAGE/BUILD_IMAGE/
* bump the glibc-openssl-fips version
* rm redundant comment
* fix FIPS checks
* set PLUGIN_PACKAGES empty until prepackaged plugins ready
* upgrade glibc-openssl-fips, use non-dev version for final stage
* another BUILD_IMAGE case
* Prepackage the FIPS versions of plugins
* relocate FIPS_ENABLED initialization before use
* s/Config File MD5/Config File Hash/
* Update the FIPS plugin names and encode the + sign
* add /var/tmp for local socket manipulation
---------
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-09-15 09:53:28 -04:00
i f e q ( $( FIPS_ENABLED ) , t r u e )
BUILD_TAGS += requirefips
e n d i f
2023-12-14 03:58:11 -05:00
DELVE ?= dlv
2023-06-11 01:24:35 -04:00
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.BuildNumber= $( BUILD_NUMBER) "
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.BuildDate= $( BUILD_DATE) "
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.BuildHash= $( BUILD_HASH) "
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.BuildHashEnterprise= $( BUILD_HASH_ENTERPRISE) "
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady= $( BUILD_ENTERPRISE_READY) "
2020-09-21 03:28:46 -04:00
2019-07-16 09:08:31 -04:00
GO_MAJOR_VERSION = $( shell $( GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VERSION = $( shell $( GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
2021-01-29 03:31:13 -05:00
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 15
2019-07-16 09:08:31 -04:00
GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $( MINIMUM_SUPPORTED_GO_MAJOR_VERSION) .$( MINIMUM_SUPPORTED_GO_MINOR_VERSION)
2025-03-11 13:44:42 -04:00
GO_COMPATIBILITY_TEST_VERSIONS := 1.22.7 1.23.6
2016-03-18 12:46:57 -04:00
2016-09-21 07:59:11 -04:00
# GOOS/GOARCH of the build host, used to determine whether we're cross-compiling or not
BUILDER_GOOS_GOARCH = " $( shell $( GO) env GOOS) _ $( shell $( GO) env GOARCH) "
2021-09-06 04:04:32 -04:00
PLATFORM_FILES = "./cmd/mattermost"
2017-10-12 15:24:54 -04:00
2016-03-18 12:46:57 -04:00
# Output paths
2015-06-15 03:53:32 -04:00
DIST_ROOT = dist
DIST_PATH = $( DIST_ROOT) /mattermost
2021-10-12 05:12:32 -04:00
DIST_PATH_LIN_AMD64 = $( DIST_ROOT) /linux_amd64/mattermost
DIST_PATH_LIN_ARM64 = $( DIST_ROOT) /linux_arm64/mattermost
2024-02-28 02:09:37 -05:00
DIST_PATH_OSX_AMD64 = $( DIST_ROOT) /darwin_amd64/mattermost
DIST_PATH_OSX_ARM64 = $( DIST_ROOT) /darwin_arm64/mattermost
2021-07-19 08:35:21 -04:00
DIST_PATH_WIN = $( DIST_ROOT) /windows/mattermost
2015-06-15 03:53:32 -04:00
2017-03-16 17:00:00 -04:00
# Packages lists
2023-08-22 06:48:53 -04:00
TE_PACKAGES = $( shell $( GO) list ./public/...) $( shell $( GO) list ./... | grep -vE 'server/v8/cmd/mmctl' )
2023-06-05 06:42:55 -04:00
MMCTL_PACKAGES = $( shell $( GO) list ./... | grep -E 'server/v8/cmd/mmctl' )
2017-03-16 17:00:00 -04:00
2021-02-25 23:22:26 -05:00
TEMPLATES_DIR = templates
2018-07-16 11:02:13 -04:00
# Plugins Packages
2023-08-25 15:39:25 -04:00
PLUGIN_PACKAGES ?= $( PLUGIN_PACKAGES:)
2025-11-04 21:04:24 -05:00
PLUGIN_PACKAGES += mattermost-plugin-calls-v1.11.0
2025-10-10 09:52:51 -04:00
PLUGIN_PACKAGES += mattermost-plugin-github-v2.5.0
2025-09-25 10:28:01 -04:00
PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.11.0
2025-12-19 09:23:55 -05:00
PLUGIN_PACKAGES += mattermost-plugin-jira-v4.5.0
2025-12-02 05:55:50 -05:00
PLUGIN_PACKAGES += mattermost-plugin-playbooks-v2.6.1
2025-11-12 17:06:19 -05:00
PLUGIN_PACKAGES += mattermost-plugin-servicenow-v2.4.0
2025-12-12 12:04:11 -05:00
PLUGIN_PACKAGES += mattermost-plugin-zoom-v1.11.0
2025-12-18 03:31:23 -05:00
PLUGIN_PACKAGES += mattermost-plugin-agents-v1.7.2
2026-01-09 10:01:21 -05:00
PLUGIN_PACKAGES += mattermost-plugin-boards-v9.2.2
2024-08-23 08:44:32 -04:00
PLUGIN_PACKAGES += mattermost-plugin-user-survey-v1.1.1
2025-12-04 09:11:00 -05:00
PLUGIN_PACKAGES += mattermost-plugin-mscalendar-v1.5.0
2025-10-30 09:57:02 -04:00
PLUGIN_PACKAGES += mattermost-plugin-msteams-meetings-v2.3.0
2025-05-15 08:24:44 -04:00
PLUGIN_PACKAGES += mattermost-plugin-metrics-v0.7.0
2025-11-12 14:14:41 -05:00
PLUGIN_PACKAGES += mattermost-plugin-channel-export-v1.3.0
2018-07-16 11:02:13 -04:00
MM-64878: FIPS Build (#33809)
* pin to ubuntu-24.04
* always use FIPS compatible Postgres settings
* use sha256 for remote cluster IDs
* use sha256 for client config hash
* rework S3 backend to be FIPS compatible
* skip setup-node during build, since already in container
* support FIPS builds
* Dockerfile for FIPS image, using glibc-openssl-fips
* workaround entrypoint inconsistencies
* authenticate to DockerHub
* fix FIPS_ENABLED, add test-mmctl-fips
* decouple check-mattermost-vet from test/build steps
* fixup! decouple check-mattermost-vet from test/build steps
* only build-linux-amd64 for fips
* rm entrypoint workaround
* tweak comment grammar
* rm unused Dockerfile.fips (for now)
* ignore gpg import errors, since would fail later anyway
* for fips, only make package-linux-amd64
* set FIPS_ENABLED for build step
* Add a FIPS-specific list of prepackaged plugins
Note that the names are still temporary, since they are not uploaded to
S3 yet. We may need to tweak them when that happens.
* s/golangci-lint/check-style/
This ensures we run all the `check-style` checks: previously,
`modernize` was missing.
* pin go-vet to @v2, remove annoying comment
* add -fips to linux-amd64.tz.gz package
* rm unused setup-chainctl
* use BUILD_TYPE_NAME instead
* mv fips build to enterprise-only
* fixup! use BUILD_TYPE_NAME instead
* temporarily pre-package no plugins for FIPS
* split package-cleanup
* undo package-cleanup, just skip ARM, also test
* skip arm for FIPS in second target too
* fmt Makefile
* Revert "rm unused Dockerfile.fips (for now)"
This reverts commit 601e37e0fff7b7703540bb9e91961ad8bb83b2e7.
* reintroduce Dockerfile.fips and align with existing Dockerfile
* s/IMAGE/BUILD_IMAGE/
* bump the glibc-openssl-fips version
* rm redundant comment
* fix FIPS checks
* set PLUGIN_PACKAGES empty until prepackaged plugins ready
* upgrade glibc-openssl-fips, use non-dev version for final stage
* another BUILD_IMAGE case
* Prepackage the FIPS versions of plugins
* relocate FIPS_ENABLED initialization before use
* s/Config File MD5/Config File Hash/
* Update the FIPS plugin names and encode the + sign
* add /var/tmp for local socket manipulation
---------
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-09-15 09:53:28 -04:00
# Overwrite the definition of PLUGIN_PACKAGES with the list of FIPS-ready plugins
# Note that the '+' in the file name is encoded as %2B for the URL we use to
# download the package from to work. This will no longer be needed when we unify
# the way we pre-package FIPS and non-FIPS plugins.
i f e q ( $( FIPS_ENABLED ) , t r u e )
2025-12-02 05:55:50 -05:00
PLUGIN_PACKAGES = mattermost-plugin-playbooks-v2.6.1%2B0e01d28-fips
2025-12-18 03:31:23 -05:00
PLUGIN_PACKAGES += mattermost-plugin-agents-v1.7.2%2B866e2dd-fips
2025-11-17 13:36:59 -05:00
PLUGIN_PACKAGES += mattermost-plugin-boards-v9.2.1%2Bdf49b26-fips
MM-64878: FIPS Build (#33809)
* pin to ubuntu-24.04
* always use FIPS compatible Postgres settings
* use sha256 for remote cluster IDs
* use sha256 for client config hash
* rework S3 backend to be FIPS compatible
* skip setup-node during build, since already in container
* support FIPS builds
* Dockerfile for FIPS image, using glibc-openssl-fips
* workaround entrypoint inconsistencies
* authenticate to DockerHub
* fix FIPS_ENABLED, add test-mmctl-fips
* decouple check-mattermost-vet from test/build steps
* fixup! decouple check-mattermost-vet from test/build steps
* only build-linux-amd64 for fips
* rm entrypoint workaround
* tweak comment grammar
* rm unused Dockerfile.fips (for now)
* ignore gpg import errors, since would fail later anyway
* for fips, only make package-linux-amd64
* set FIPS_ENABLED for build step
* Add a FIPS-specific list of prepackaged plugins
Note that the names are still temporary, since they are not uploaded to
S3 yet. We may need to tweak them when that happens.
* s/golangci-lint/check-style/
This ensures we run all the `check-style` checks: previously,
`modernize` was missing.
* pin go-vet to @v2, remove annoying comment
* add -fips to linux-amd64.tz.gz package
* rm unused setup-chainctl
* use BUILD_TYPE_NAME instead
* mv fips build to enterprise-only
* fixup! use BUILD_TYPE_NAME instead
* temporarily pre-package no plugins for FIPS
* split package-cleanup
* undo package-cleanup, just skip ARM, also test
* skip arm for FIPS in second target too
* fmt Makefile
* Revert "rm unused Dockerfile.fips (for now)"
This reverts commit 601e37e0fff7b7703540bb9e91961ad8bb83b2e7.
* reintroduce Dockerfile.fips and align with existing Dockerfile
* s/IMAGE/BUILD_IMAGE/
* bump the glibc-openssl-fips version
* rm redundant comment
* fix FIPS checks
* set PLUGIN_PACKAGES empty until prepackaged plugins ready
* upgrade glibc-openssl-fips, use non-dev version for final stage
* another BUILD_IMAGE case
* Prepackage the FIPS versions of plugins
* relocate FIPS_ENABLED initialization before use
* s/Config File MD5/Config File Hash/
* Update the FIPS plugin names and encode the + sign
* add /var/tmp for local socket manipulation
---------
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-09-15 09:53:28 -04:00
e n d i f
2022-05-05 12:12:31 -04:00
EE_PACKAGES = $( shell $( GO) list $( BUILD_ENTERPRISE_DIR) /...)
2017-11-14 14:13:31 -05:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2023-06-14 17:33:26 -04:00
ALL_PACKAGES = $( TE_PACKAGES) $( EE_PACKAGES)
2017-11-14 14:13:31 -05:00
e l s e
2023-06-14 17:33:26 -04:00
ALL_PACKAGES = $( TE_PACKAGES)
2022-11-21 22:47:07 -05:00
e n d i f
2024-07-08 02:16:09 -04:00
CONFIG_FILE_PATH ?= ./config/config.json
2020-02-11 12:29:38 -05:00
all : run ## Alias for 'run'.
2020-02-03 16:58:15 -05:00
2020-07-13 16:29:39 -04:00
- i n c l u d e c o n f i g . o v e r r i d e . m k
2022-06-09 05:45:17 -04:00
# Make sure not to modify an overridden ENABLED_DOCKER_SERVICES variable
DOCKER_SERVICES_OVERRIDE = false
i f n e q ( , $( ENABLED_DOCKER_SERVICES ) )
$( info ENABLED_DOCKER_SERVICES has been overridden)
DOCKER_SERVICES_OVERRIDE = true
e n d i f
2020-07-13 16:29:39 -04:00
i n c l u d e c o n f i g . m k
2017-08-10 12:11:55 -04:00
i n c l u d e b u i l d / * . m k
2023-08-21 03:50:30 -04:00
i n c l u d e p u b l i c / M a k e f i l e
2015-11-22 20:39:03 -05:00
2023-06-11 01:24:35 -04:00
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.MockCWS= $( MM_ENABLE_CWS_MOCK) "
2023-08-31 10:59:04 -04:00
LDFLAGS += -X " github.com/mattermost/mattermost/server/public/model.MattermostGiphySdkKey= $( MM_GIPHY_SDK_KEY) "
2021-04-22 08:25:56 -04:00
2020-07-13 16:29:39 -04:00
RUN_IN_BACKGROUND ?=
i f e q ( $( RUN_SERVER_IN_BACKGROUND ) , t r u e )
RUN_IN_BACKGROUND := &
e n d i f
2022-02-15 08:38:50 -05:00
DOCKER_COMPOSE_OVERRIDE =
i f n e q ( "$(wildcard ./docker-compose.override.yaml)" , "" )
2022-06-09 05:45:17 -04:00
DOCKER_COMPOSE_OVERRIDE = -f docker-compose.override.yaml
2022-02-15 08:38:50 -05:00
e n d i f
2023-12-02 07:20:15 -05:00
i f e q ( $( ARM_BASED_MAC ) , t r u e )
$( info Apple Silicon detected, applying elasticsearch override)
2022-06-17 07:42:56 -04:00
DOCKER_COMPOSE_OVERRIDE := -f docker-compose.makefile.m1.yml $( DOCKER_COMPOSE_OVERRIDE)
e n d i f
2025-09-15 14:58:43 -04:00
# Support for pgvector postgres image
MM_USE_PGVECTOR ?= false
i f e q ( $( MM_USE_PGVECTOR ) , t r u e )
$( info Using pgvector/pgvector image for PostgreSQL)
DOCKER_COMPOSE_OVERRIDE := -f docker-compose.pgvector.yml $( DOCKER_COMPOSE_OVERRIDE)
e n d i f
2022-06-09 05:45:17 -04:00
i f n e q ( $( DOCKER_SERVICES_OVERRIDE ) , t r u e )
ifeq ( ,$( findstring minio,$( ENABLED_DOCKER_SERVICES) ) )
TEMP_DOCKER_SERVICES:= $( TEMP_DOCKER_SERVICES) minio
2020-08-11 04:41:23 -04:00
endif
2022-06-09 05:45:17 -04:00
ifeq ( $( BUILD_ENTERPRISE_READY) ,true)
ifeq ( ,$( findstring openldap,$( ENABLED_DOCKER_SERVICES) ) )
TEMP_DOCKER_SERVICES:= $( TEMP_DOCKER_SERVICES) openldap
endif
2020-08-11 04:41:23 -04:00
endif
2022-06-09 05:45:17 -04:00
ENABLED_DOCKER_SERVICES:= $( ENABLED_DOCKER_SERVICES) $( TEMP_DOCKER_SERVICES)
2020-07-29 10:51:15 -04:00
e n d i f
2017-12-20 14:49:45 -05:00
start-docker : ## Starts the docker containers for local development.
2019-09-30 14:50:56 -04:00
i f n e q ( $( IS_CI ) , f a l s e )
@echo CI Build: skipping docker start
e l s e i f e q ( $( MM_NO_DOCKER ) , t r u e )
@echo No Docker Enabled: skipping docker start
e l s e
2015-11-22 20:39:03 -05:00
@echo Starting docker containers
2025-09-15 14:58:43 -04:00
i f e q ( $( MM_USE_PGVECTOR ) , t r u e )
@echo Using pgvector PostgreSQL image
e n d i f
2015-11-22 20:39:03 -05:00
2023-11-13 08:30:24 -05:00
docker compose rm start_dependencies
$( GO) run ./build/docker-compose-generator/main.go $( ENABLED_DOCKER_SERVICES) | docker compose -f docker-compose.makefile.yml -f /dev/stdin $( DOCKER_COMPOSE_OVERRIDE) run -T --rm start_dependencies
2022-06-09 05:45:17 -04:00
ifneq ( ,$( findstring openldap,$( ENABLED_DOCKER_SERVICES) ) )
2025-04-14 07:29:42 -04:00
cat tests/custom-schema-objectID.ldif | docker compose -f docker-compose.makefile.yml $( DOCKER_COMPOSE_OVERRIDE) exec -T openldap bash -c 'ldapadd -Y EXTERNAL -H ldapi:/// -w mostest || true' ;
2025-04-11 13:41:26 -04:00
cat tests/custom-schema-cpa.ldif | docker compose -f docker-compose.makefile.yml ${ DOCKER_COMPOSE_OVERRIDE } exec -T openldap bash -c 'ldapadd -Y EXTERNAL -H ldapi:/// -w mostest || true' ;
cat tests/${ LDAP_DATA } -data.ldif | docker compose -f docker-compose.makefile.yml ${ DOCKER_COMPOSE_OVERRIDE } exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest || true' ;
2022-06-09 05:45:17 -04:00
endif
2018-12-10 11:58:09 -05:00
e n d i f
2016-09-15 08:35:44 -04:00
2023-04-20 14:34:36 -04:00
update-docker : stop -docker ## Updates the docker containers for local development.
@echo Updating docker containers
2023-11-13 08:30:24 -05:00
$( GO) run ./build/docker-compose-generator/main.go $( ENABLED_DOCKER_SERVICES) | docker compose -f docker-compose.makefile.yml -f /dev/stdin $( DOCKER_COMPOSE_OVERRIDE) up --no-start
2023-04-20 14:34:36 -04:00
2021-04-28 02:29:55 -04:00
run-haserver :
2021-01-18 12:38:44 -05:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2021-04-01 13:44:56 -04:00
@echo Starting mattermost in an HA topology '(3 node cluster)'
2021-01-18 12:38:44 -05:00
2023-11-13 08:30:24 -05:00
docker compose -f docker-compose.yaml $( DOCKER_COMPOSE_OVERRIDE) up --remove-orphans haproxy
2021-01-18 12:38:44 -05:00
e n d i f
2021-04-28 02:29:55 -04:00
stop-haserver :
2021-04-01 13:44:56 -04:00
@echo Stopping docker containers for HA topology
2023-11-13 08:30:24 -05:00
docker compose stop
2021-04-01 13:44:56 -04:00
2017-12-20 14:49:45 -05:00
stop-docker : ## Stops the docker containers for local development.
2019-09-30 14:50:56 -04:00
i f e q ( $( MM_NO_DOCKER ) , t r u e )
@echo No Docker Enabled: skipping docker stop
e l s e
2015-11-22 20:39:03 -05:00
@echo Stopping docker containers
2015-06-15 03:53:32 -04:00
2023-11-13 08:30:24 -05:00
docker compose stop
2019-09-30 14:50:56 -04:00
e n d i f
2018-12-10 11:58:09 -05:00
2017-12-20 14:49:45 -05:00
clean-docker : ## Deletes the docker containers for local development.
2019-09-30 14:50:56 -04:00
i f e q ( $( MM_NO_DOCKER ) , t r u e )
@echo No Docker Enabled: skipping docker clean
e l s e
2015-11-22 20:39:03 -05:00
@echo Removing docker containers
2015-06-15 03:53:32 -04:00
2023-11-13 08:30:24 -05:00
docker compose down -v
docker compose rm -v
2025-10-16 11:22:53 -04:00
docker volume rm mattermost-server_postgres-14-data || true
2019-09-30 14:50:56 -04:00
e n d i f
2016-04-22 01:37:01 -04:00
2019-11-18 06:08:13 -05:00
plugin-checker :
2023-05-10 12:07:02 -04:00
$( GO) run $( GOFLAGS) ./public/plugin/checker
2016-10-17 09:52:47 -04:00
2023-09-29 10:41:53 -04:00
prepackaged-plugins : ## Populate the prepackaged-plugins directory.
2023-08-25 15:39:25 -04:00
@echo Downloading prepackaged plugins: $( PLUGIN_PACKAGES)
2020-01-22 13:39:02 -05:00
mkdir -p prepackaged_plugins
@cd prepackaged_plugins && for plugin_package in $( PLUGIN_PACKAGES) ; do \
2024-07-03 01:23:43 -04:00
curl -f -O -L https://plugins.releases.mattermost.com/release/$$ plugin_package.tar.gz; \
curl -f -O -L https://plugins.releases.mattermost.com/release/$$ plugin_package.tar.gz.sig; \
2020-01-22 13:39:02 -05:00
done
2020-02-03 16:58:15 -05:00
prepackaged-binaries : ## Populate the prepackaged-binaries to the bin directory
2020-02-14 15:45:32 -05:00
i f e q ( $( shell test -f bin /mmctl && printf "yes ") , y e s )
2023-06-05 06:42:55 -04:00
@echo "MMCTL already exists in bin/mmctl, not compiling."
2020-02-03 16:58:15 -05:00
e l s e
2023-06-05 06:42:55 -04:00
$( MAKE) mmctl-build
2020-02-03 16:58:15 -05:00
e n d i f
2025-03-11 13:44:42 -04:00
golang-versions : ## Install Golang versions used for compatibility testing (e.g. plugins)
@for version in $( GO_COMPATIBILITY_TEST_VERSIONS) ; do \
$( GO) install golang.org/dl/go$$ version@latest && \
$( GOBIN) /go$$ version download; \
done
export GO_COMPATIBILITY_TEST_VERSIONS = " ${ GO_COMPATIBILITY_TEST_VERSIONS } "
2019-11-18 06:08:13 -05:00
golangci-lint : ## Run golangci-lint on codebase
2025-11-04 06:09:11 -05:00
$( GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0
2019-11-25 12:54:54 -05:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2025-05-30 11:31:30 -04:00
$( GOBIN) /golangci-lint run ./... ./public/... $( BUILD_ENTERPRISE_DIR) /...
e l s e
$( GOBIN) /golangci-lint run ./... ./public/...
2020-01-07 06:37:57 -05:00
e n d i f
2019-10-26 03:12:07 -04:00
2018-11-29 11:19:26 -05:00
i18n-extract : ## Extract strings for translation from the source code
2023-07-17 09:15:58 -04:00
cd ../tools/mmgotool && $( GO) install .
2020-07-21 08:07:27 -04:00
$( GOBIN) /mmgotool i18n extract --portal-dir= ""
2018-11-29 11:19:26 -05:00
2021-01-04 15:22:34 -05:00
i18n-check : ## Exit on empty translation strings and translation source strings
2023-07-17 09:15:58 -04:00
cd ../tools/mmgotool && $( GO) install .
2020-08-31 04:43:09 -04:00
$( GOBIN) /mmgotool i18n clean-empty --portal-dir= "" --check
2021-01-04 15:22:34 -05:00
$( GOBIN) /mmgotool i18n check-empty-src --portal-dir= ""
2020-08-31 04:43:09 -04:00
2017-12-20 14:49:45 -05:00
store-mocks : ## Creates mock files.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config channels/store/.mockery.yaml
2017-10-26 12:36:54 -04:00
2024-08-05 23:58:41 -04:00
cache-mocks :
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config platform/services/cache/.mockery.yaml
2024-08-05 23:58:41 -04:00
2020-09-08 14:30:54 -04:00
2019-08-01 16:10:58 -04:00
store-layers : ## Generate layers for the store
2023-03-22 17:22:27 -04:00
$( GO) generate $( GOFLAGS) ./channels/store
2019-08-01 16:10:58 -04:00
2022-04-15 02:29:59 -04:00
new-migration : ## Creates a new migration. Run with make new-migration name=<>
2023-06-08 09:30:21 -04:00
$( GO) install github.com/mattermost/morph/cmd/morph@1e0640c
2021-02-23 09:22:31 -05:00
@echo "Generating new migration for postgres"
2023-06-08 09:30:21 -04:00
$( GOBIN) /morph new script $( name) --driver postgres --dir channels/db/migrations --sequence
2021-02-23 09:22:31 -05:00
2021-03-02 08:37:21 -05:00
filestore-mocks : ## Creates mock files.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config platform/shared/filestore/.mockery.yaml
2018-09-20 13:07:03 -04:00
2018-05-10 12:46:09 -04:00
ldap-mocks : ## Creates mock files for ldap.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-04-25 06:46:19 -04:00
$( GOBIN) /mockery --dir $( BUILD_ENTERPRISE_DIR) /ldap --all --inpackage --note 'Regenerate this file using `make ldap-mocks`.'
2018-05-15 16:33:47 -04:00
plugin-mocks : ## Creates mock files for plugins.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config public/plugin/.mockery.yaml
2018-06-25 15:33:13 -04:00
2019-07-08 11:32:29 -04:00
einterfaces-mocks : ## Creates mock files for einterfaces.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config einterfaces/.mockery.yaml
2019-07-08 11:32:29 -04:00
2020-03-13 10:33:18 -04:00
searchengine-mocks : ## Creates mock files for searchengines.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config platform/services/searchengine/.mockery.yaml
2020-03-13 10:33:18 -04:00
2021-04-01 13:44:56 -04:00
sharedchannel-mocks : ## Creates mock files for shared channels.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config platform/services/sharedchannel/.mockery.yaml
2021-04-01 13:44:56 -04:00
2021-06-17 08:07:34 -04:00
misc-mocks : ## Creates mocks for misc interfaces.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config channels/utils/.mockery.yaml
2021-06-17 08:07:34 -04:00
2022-03-02 16:26:57 -05:00
email-mocks : ## Creates mocks for misc interfaces.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config channels/app/email/.mockery.yaml
2022-03-02 16:26:57 -05:00
2022-10-06 04:04:21 -04:00
platform-mocks : ## Creates mocks for platform interfaces.
2025-06-10 14:04:57 -04:00
$( GO) install github.com/vektra/mockery/v2/...@v2.53.4
2024-11-07 06:48:11 -05:00
$( GOBIN) /mockery --config channels/app/platform/.mockery.yaml
2022-10-06 04:04:21 -04:00
2023-06-05 06:42:55 -04:00
mmctl-mocks : ## Creates mocks for mmctl
$( GO) install github.com/golang/mock/mockgen@v1.6.0
2023-06-11 01:24:35 -04:00
$( GOBIN) /mockgen -destination= cmd/mmctl/mocks/client_mock.go -copyright_file= cmd/mmctl/mocks/copyright.txt -package= mocks github.com/mattermost/mattermost/server/v8/cmd/mmctl/client Client
2023-06-05 06:42:55 -04:00
2018-06-25 15:33:13 -04:00
pluginapi : ## Generates api and hooks glue code for plugins
2023-06-23 06:24:52 -04:00
cd ./public && $( GO) generate $( GOFLAGS) ./plugin
2017-12-05 16:35:46 -05:00
2025-09-04 14:46:18 -04:00
mocks : store -mocks filestore -mocks ldap -mocks plugin -mocks einterfaces -mocks searchengine -mocks sharedchannel -mocks misc -mocks email -mocks platform -mocks mmctl -mocks mocks -public cache -mocks
2022-07-05 11:39:31 -04:00
2025-01-29 15:06:55 -05:00
layers : store -layers pluginapi
2022-07-05 11:39:31 -04:00
generated : mocks layers
2022-05-05 12:12:31 -04:00
check-prereqs-enterprise : setup -go -work ## Checks prerequisite software status for enterprise.
2020-07-22 07:29:12 -04:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
./scripts/prereq-check-enterprise.sh
e n d i f
2022-06-23 07:55:50 -04:00
setup-go-work : export BUILD_ENTERPRISE_READY := $( BUILD_ENTERPRISE_READY )
2022-05-05 12:12:31 -04:00
setup-go-work : ## Sets up your go.work file
2023-05-10 12:07:02 -04:00
i f n e q ( $( IGNORE_GO_WORK_IF_EXISTS ) , t r u e )
@echo "Creating a go.work file"
rm -f go.work
2024-03-19 12:53:26 -04:00
$( GO) work init
$( GO) work use .
$( GO) work use ./public
2023-05-10 12:07:02 -04:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2024-03-19 12:53:26 -04:00
$( GO) work use ../../enterprise
2023-05-10 12:07:02 -04:00
e n d i f
e n d i f
2022-05-05 12:12:31 -04:00
2025-11-04 06:09:11 -05:00
check-style : plugin -checker vet golangci -lint ## Runs style/lint checks
2023-05-05 00:38:35 -04:00
2023-06-15 14:27:52 -04:00
gotestsum :
2023-10-23 10:54:42 -04:00
$( GO) install gotest.tools/gotestsum@v1.11.0
2018-11-28 09:05:39 -05:00
2023-06-15 14:27:52 -04:00
test-compile : gotestsum ## Compile tests.
2018-11-28 13:56:21 -05:00
@echo COMPILE TESTS
2023-08-22 06:48:53 -04:00
for package in $( TE_PACKAGES) $( EE_PACKAGES) ; do \
2018-11-28 13:56:21 -05:00
$( GO) test $( GOFLAGS) -c $$ package; \
done
2024-09-20 06:08:35 -04:00
modules-tidy : ## Tidy Go modules
2024-01-08 09:47:24 -05:00
mv enterprise/external_imports.go enterprise/external_imports.go.orig
2022-06-13 10:20:50 -04:00
-$( GO) mod tidy
2023-05-10 12:07:02 -04:00
-cd public && $( GO) mod tidy
2024-01-08 09:47:24 -05:00
mv enterprise/external_imports.go.orig enterprise/external_imports.go
2022-06-13 10:20:50 -04:00
2025-03-11 13:44:42 -04:00
test-server-pre : check -prereqs -enterprise start -docker gotestsum golang -versions ## Runs tests.
2018-12-06 13:19:32 -05:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
@echo Running all tests
e l s e
@echo Running only TE tests
e n d i f
2021-03-22 13:41:50 -04:00
2023-06-15 14:27:52 -04:00
test-server-race : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-server-race : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-server-race : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2021-03-22 13:41:50 -04:00
test-server-race : test -server -pre
2023-06-15 14:27:52 -04:00
i f e q ( $( IS_CI ) , t r u e )
2025-11-18 10:36:01 -05:00
GOMAXPROCS = 4 $( GOBIN) /gotestsum --rerun-fails= 3 --packages= " $( TE_PACKAGES) $( EE_PACKAGES) " -- -race $( GOFLAGS) -timeout= 3h
2023-06-15 14:27:52 -04:00
e l s e
2025-11-18 10:36:01 -05:00
$( GOBIN) /gotestsum --rerun-fails= 3 --packages= " $( TE_PACKAGES) $( EE_PACKAGES) " -- -race $( GOFLAGS) -timeout= 3h
2023-06-15 14:27:52 -04:00
e n d i f
2022-06-09 05:45:17 -04:00
i f n e q ( $( IS_CI ) , t r u e )
ifneq ( $( MM_NO_DOCKER) ,true)
ifneq ( $( TEMP_DOCKER_SERVICES) ,)
@echo Stopping temporary docker services
2023-11-13 08:30:24 -05:00
docker compose stop $( TEMP_DOCKER_SERVICES)
2021-03-22 13:41:50 -04:00
endif
endif
2022-06-09 05:45:17 -04:00
e n d i f
2021-03-22 13:41:50 -04:00
2023-06-15 14:27:52 -04:00
test-server : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-server : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-server : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2021-03-22 13:41:50 -04:00
test-server : test -server -pre
2025-05-30 07:58:26 -04:00
$( GOBIN) /gotestsum --rerun-fails= 3 --packages= " $( TE_PACKAGES) $( EE_PACKAGES) " -- $( GOFLAGS) -timeout= 90m $( COVERAGE_FLAG)
2022-06-09 05:45:17 -04:00
i f n e q ( $( IS_CI ) , t r u e )
ifneq ( $( MM_NO_DOCKER) ,true)
ifneq ( $( TEMP_DOCKER_SERVICES) ,)
@echo Stopping temporary docker services
2023-11-13 08:30:24 -05:00
docker compose stop $( TEMP_DOCKER_SERVICES)
2020-08-11 04:41:23 -04:00
endif
endif
2022-06-09 05:45:17 -04:00
e n d i f
2020-08-11 04:41:23 -04:00
2023-06-15 14:27:52 -04:00
test-server-ee : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-server-ee : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-server-ee : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
test-server-ee : check -prereqs -enterprise start -docker gotestsum ## Runs EE tests.
2020-07-22 06:03:46 -04:00
@echo Running only EE tests
2023-06-15 14:27:52 -04:00
$( GOBIN) /gotestsum --packages= " $( EE_PACKAGES) " -- $( GOFLAGS) -timeout= 20m
2020-07-22 06:03:46 -04:00
2023-06-15 14:27:52 -04:00
test-server-quick : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-server-quick : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-server-quick : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2020-07-22 07:29:12 -04:00
test-server-quick : check -prereqs -enterprise ## Runs only quick tests.
2020-03-02 11:13:39 -05:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
@echo Running all tests
2023-08-22 06:48:53 -04:00
$( GOBIN) /gotestsum --packages= " $( TE_PACKAGES) $( EE_PACKAGES) " -- $( GOFLAGS) -short
2020-03-02 11:13:39 -05:00
e l s e
@echo Running only TE tests
2023-08-22 06:48:53 -04:00
$( GOBIN) /gotestsum --packages= " $( TE_PACKAGES) " -- $( GOFLAGS) -short
2020-03-02 11:13:39 -05:00
e n d i f
2017-12-20 14:49:45 -05:00
internal-test-web-client : ## Runs web client tests.
2017-10-12 15:24:54 -04:00
$( GO) run $( GOFLAGS) $( PLATFORM_FILES) test web_client_tests
2016-04-22 01:37:01 -04:00
2017-12-20 14:49:45 -05:00
run-server-for-web-client-tests : ## Tests the server for web client.
2017-10-12 15:24:54 -04:00
$( GO) run $( GOFLAGS) $( PLATFORM_FILES) test web_client_tests_server
2017-03-23 14:05:36 -04:00
2017-12-20 14:49:45 -05:00
test-client : ## Test client app.
2016-05-13 16:17:07 -04:00
@echo Running client tests
2016-04-22 01:37:01 -04:00
cd $( BUILD_WEBAPP_DIR) && $( MAKE) test
2017-12-20 14:49:45 -05:00
test : test -server test -client ## Runs all checks and tests below (except race detection and postgres).
2015-06-15 03:53:32 -04:00
2017-12-20 14:49:45 -05:00
cover : ## Runs the golang coverage tool. You must run the unit tests first.
2016-05-20 09:40:52 -04:00
@echo Opening coverage info in browser. If this failed run make test first
$( GO) tool cover -html= cover.out
$( GO) tool cover -html= ecover.out
2023-10-30 11:41:14 -04:00
test-data : export MM_SERVICESETTINGS_ENABLELOCALMODE := true
2023-10-23 12:22:07 -04:00
test-data : run -server inject -test -data stop -server ## start a local instance and add test data to it.
2022-03-07 14:57:04 -05:00
inject-test-data : # add test data to the local instance.
2021-08-23 09:45:07 -04:00
@if ! ./scripts/wait-for-system-start.sh; then \
2023-08-16 03:09:11 -04:00
make stop-server; \
2021-08-23 09:45:07 -04:00
fi
bin/mmctl config set TeamSettings.MaxUsersPerTeam 100 --local
bin/mmctl sampledata -u 60 --local
2018-01-31 19:32:18 -05:00
@echo You may need to restart the Mattermost server before using the following
2018-03-23 15:32:10 -04:00
@echo = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2019-08-02 13:42:25 -04:00
@echo Login with a system admin account username = sysadmin password = Sys@dmin-sample1
@echo Login with a regular account username = user-1 password = SampleUs@r-1
2018-03-23 15:32:10 -04:00
@echo = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2018-01-31 19:32:18 -05:00
2023-06-15 14:27:52 -04:00
test-mmctl-unit : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-mmctl-unit : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-mmctl-unit : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2025-08-29 11:01:12 -04:00
test-mmctl-unit : check -prereqs -enterprise gotestsum
2023-06-05 06:42:55 -04:00
@echo Running mmctl unit tests
2023-06-15 14:27:52 -04:00
$( GOBIN) /gotestsum --packages= " $( MMCTL_PACKAGES) " -- -tags 'unit $(MMCTL_BUILD_TAGS)' $( MMCTL_TESTFLAGS)
2023-06-05 06:42:55 -04:00
2023-06-15 14:27:52 -04:00
test-mmctl-e2e : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-mmctl-e2e : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-mmctl-e2e : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2025-08-29 11:01:12 -04:00
test-mmctl-e2e : check -prereqs -enterprise gotestsum start -docker
2023-06-05 06:42:55 -04:00
@echo Running mmctl e2e tests
2023-06-15 14:27:52 -04:00
$( GOBIN) /gotestsum --packages= " $( MMCTL_PACKAGES) " -- -tags 'e2e $(MMCTL_BUILD_TAGS)' $( MMCTL_TESTFLAGS)
2023-06-05 06:42:55 -04:00
2023-08-28 08:01:14 -04:00
test-mmctl : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-mmctl : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-mmctl : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2025-08-29 11:01:12 -04:00
test-mmctl : check -prereqs -enterprise gotestsum start -docker
2023-06-05 06:42:55 -04:00
@echo Running all mmctl tests
2023-06-15 14:27:52 -04:00
$( GOBIN) /gotestsum --packages= " $( MMCTL_PACKAGES) " -- -tags 'unit e2e $(MMCTL_BUILD_TAGS)' $( MMCTL_TESTFLAGS)
2023-06-05 06:42:55 -04:00
2023-08-28 08:01:14 -04:00
test-mmctl-coverage : export GOTESTSUM_FORMAT := $( GOTESTSUM_FORMAT )
test-mmctl-coverage : export GOTESTSUM_JUNITFILE := $( GOTESTSUM_JUNITFILE )
test-mmctl-coverage : export GOTESTSUM_JSONFILE := $( GOTESTSUM_JSONFILE )
2025-08-29 11:01:12 -04:00
test-mmctl-coverage : check -prereqs -enterprise gotestsum start -docker
2023-06-05 06:42:55 -04:00
@echo Running all mmctl tests with coverage
2023-06-15 14:27:52 -04:00
$( GOBIN) /gotestsum --packages= " $( MMCTL_PACKAGES) " -- -tags 'unit e2e $(MMCTL_BUILD_TAGS)' -coverprofile= mmctlcover.out $( MMCTL_TESTFLAGS)
2023-06-05 06:42:55 -04:00
$( GO) tool cover -html= mmctlcover.out
2019-07-16 09:08:31 -04:00
validate-go-version : ## Validates the installed version of go against Mattermost's minimum requirement.
@if [ $( GO_MAJOR_VERSION) -gt $( MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ] ; then \
exit 0 ; \
elif [ $( GO_MAJOR_VERSION) -lt $( MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ] ; then \
echo '$(GO_VERSION_VALIDATION_ERR_MSG)' ; \
exit 1; \
elif [ $( GO_MINOR_VERSION) -lt $( MINIMUM_SUPPORTED_GO_MINOR_VERSION) ] ; then \
echo '$(GO_VERSION_VALIDATION_ERR_MSG)' ; \
exit 1; \
fi
2021-02-25 23:22:26 -05:00
build-templates : ## Compile all mjml email templates
cd $( TEMPLATES_DIR) && $( MAKE) build
2023-03-22 17:22:27 -04:00
run-server : setup -go -work prepackaged -binaries validate -go -version start -docker client ## Starts the server.
2016-03-18 12:46:57 -04:00
@echo Running mattermost for development
2025-09-15 14:58:43 -04:00
i f e q ( $( MM_USE_PGVECTOR ) , t r u e )
@echo With pgvector PostgreSQL support enabled
e n d i f
2016-03-18 12:46:57 -04:00
2023-03-22 17:22:27 -04:00
mkdir -p $( BUILD_WEBAPP_DIR) /channels/dist/files
2024-01-08 09:47:24 -05:00
$( GO) run $( GOFLAGS) -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' $( PLATFORM_FILES) $( RUN_IN_BACKGROUND)
2016-03-18 12:46:57 -04:00
2025-09-15 14:58:43 -04:00
run-server-pgvector : ## Starts the server with pgvector PostgreSQL image.
@MM_USE_PGVECTOR= true $( MAKE) run-server
2019-08-16 02:45:42 -04:00
debug-server : start -docker ## Compile and start server using delve.
2023-03-22 17:22:27 -04:00
mkdir -p $( BUILD_WEBAPP_DIR) /channels/dist/files
2018-08-27 07:56:31 -04:00
$( DELVE) debug $( PLATFORM_FILES) --build-flags= " -ldflags '\
2023-06-11 01:24:35 -04:00
-X github.com/mattermost/mattermost/server/public/model.BuildNumber= $( BUILD_NUMBER) \
-X \" github.com/mattermost/mattermost/server/public/model.BuildDate= $( BUILD_DATE) \" \
-X github.com/mattermost/mattermost/server/public/model.BuildHash= $( BUILD_HASH) \
-X github.com/mattermost/mattermost/server/public/model.BuildHashEnterprise= $( BUILD_HASH_ENTERPRISE) \
2024-01-08 09:47:24 -05:00
-X github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady= $( BUILD_ENTERPRISE_READY) ' \
-tags '$(BUILD_TAGS)' "
2018-08-27 07:56:31 -04:00
2019-08-16 02:45:42 -04:00
debug-server-headless : start -docker ## Debug server from within an IDE like VSCode or IntelliJ.
2023-03-22 17:22:27 -04:00
mkdir -p $( BUILD_WEBAPP_DIR) /channels/dist/files
2019-07-17 07:36:58 -04:00
$( DELVE) debug --headless --listen= :2345 --api-version= 2 --accept-multiclient $( PLATFORM_FILES) --build-flags= " -ldflags '\
2023-06-11 01:24:35 -04:00
-X github.com/mattermost/mattermost/server/public/model.BuildNumber= $( BUILD_NUMBER) \
-X \" github.com/mattermost/mattermost/server/public/model.BuildDate= $( BUILD_DATE) \" \
-X github.com/mattermost/mattermost/server/public/model.BuildHash= $( BUILD_HASH) \
-X github.com/mattermost/mattermost/server/public/model.BuildHashEnterprise= $( BUILD_HASH_ENTERPRISE) \
2024-01-08 09:47:24 -05:00
-X github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady= $( BUILD_ENTERPRISE_READY) ' \
-tags '$(BUILD_TAGS)' "
2019-07-17 07:36:58 -04:00
2024-09-19 04:00:56 -04:00
run-node : export MM_SERVICESETTINGS_SITEURL =http ://localhost :8066
run-node : export MM_SERVICESETTINGS_LISTENADDRESS =:8066
run-node : export MM_SERVICESETTINGS_ENABLELOCALMODE =true
run-node : export MM_SERVICESETTINGS_LOCALMODESOCKETLOCATION =/var /tmp /mattermost_local_node .socket
run-node : export MM_SQLSETTINGS_DRIVERNAME =postgres
run-node : export MM_SQLSETTINGS_DATASOURCE =postgres ://mmuser :mostest @localhost /mattermost_node_test ?sslmode =disable &sslmode =disable &connect_timeout =10&binary_parameters =yes
run-node : start -docker ## Runs a shared channel node.
@echo Running mattermost node
$( GO) run $( GOFLAGS) -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' $( PLATFORM_FILES) $( RUN_IN_BACKGROUND)
2017-12-20 14:49:45 -05:00
run-cli : start -docker ## Runs CLI.
2016-07-06 14:11:21 -04:00
@echo Running mattermost for development
2016-10-19 14:49:25 -04:00
@echo Example should be like 'make ARGS="-version" run-cli'
2016-07-06 14:11:21 -04:00
2024-01-08 09:47:24 -05:00
$( GO) run $( GOFLAGS) -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' $( PLATFORM_FILES) ${ ARGS }
2016-07-06 14:11:21 -04:00
2023-03-22 17:22:27 -04:00
run-client : client ## Runs the webapp.
2016-03-18 12:46:57 -04:00
@echo Running mattermost client for development
2016-03-24 09:34:35 -04:00
cd $( BUILD_WEBAPP_DIR) && $( MAKE) run
2016-03-18 12:46:57 -04:00
2023-03-22 17:22:27 -04:00
client : ## Sets up a symlink to the compiled files generated by the web app
@echo Setting up symlink to client directory
ln -nfs $( BUILD_WEBAPP_DIR) /channels/dist client
run-client-fullmap : client ## Legacy alias to run-client
2018-12-05 13:13:00 -05:00
@echo Running mattermost client for development
2016-03-29 18:32:15 -04:00
2018-12-05 13:13:00 -05:00
cd $( BUILD_WEBAPP_DIR) && $( MAKE) run
2016-03-29 18:32:15 -04:00
2023-12-02 07:20:15 -05:00
run : run -server run -client ## Runs the server and webapp.
2016-02-17 10:14:29 -05:00
2025-09-15 14:58:43 -04:00
run-pgvector : ## Runs the server and webapp with pgvector PostgreSQL image.
@MM_USE_PGVECTOR= true $( MAKE) run
2018-12-05 13:13:00 -05:00
run-fullmap : run -server run -client ## Legacy alias to run
2016-03-29 18:32:15 -04:00
2017-12-20 14:49:45 -05:00
stop-server : ## Stops the server.
2016-03-18 12:46:57 -04:00
@echo Stopping mattermost
2016-10-04 08:56:01 -04:00
i f e q ( $( BUILDER_GOOS_GOARCH ) , "windows_amd64" )
wmic process where "Caption='go.exe' and CommandLine like '%go.exe run%'" call terminate
wmic process where "Caption='mattermost.exe' and CommandLine like '%go-build%'" call terminate
e l s e
2021-09-06 04:04:32 -04:00
@for PID in $$ ( ps -ef | grep "[g]o run" | grep "mattermost" | awk '{ print $$2 }' ) ; do \
2016-02-17 10:14:29 -05:00
echo stopping go $$ PID; \
2015-06-15 03:53:32 -04:00
kill $$ PID; \
done
2021-09-06 04:04:32 -04:00
@for PID in $$ ( ps -ef | grep "[g]o-build" | grep "mattermost" | awk '{ print $$2 }' ) ; do \
2016-02-17 10:14:29 -05:00
echo stopping mattermost $$ PID; \
kill $$ PID; \
done
2017-01-12 10:47:29 -05:00
e n d i f
2015-07-27 09:48:35 -04:00
2017-12-20 14:49:45 -05:00
stop-client : ## Stops the webapp.
2016-03-18 12:46:57 -04:00
@echo Stopping mattermost client
2016-03-18 08:48:26 -04:00
2016-03-24 09:34:35 -04:00
cd $( BUILD_WEBAPP_DIR) && $( MAKE) stop
2015-12-08 13:38:43 -05:00
2019-11-12 02:32:06 -05:00
stop : stop -server stop -client stop -docker ## Stops server, client and the docker compose.
2016-03-18 12:46:57 -04:00
2017-12-20 14:49:45 -05:00
restart : restart -server restart -client ## Restarts the server and webapp.
2016-07-05 11:10:28 -04:00
2017-12-20 14:49:45 -05:00
restart-server : | stop -server run -server ## Restarts the mattermost server to pick up development change.
2016-03-18 12:46:57 -04:00
2025-09-15 14:58:43 -04:00
restart-server-pgvector : ## Restarts the server with pgvector PostgreSQL image.
@MM_USE_PGVECTOR= true $( MAKE) restart-server
2021-01-18 12:38:44 -05:00
restart-haserver :
@echo Restarting mattermost in an HA topology
2023-11-13 08:30:24 -05:00
docker compose restart follower2
docker compose restart follower
docker compose restart leader
docker compose restart haproxy
2021-01-18 12:38:44 -05:00
2017-12-20 14:49:45 -05:00
restart-client : | stop -client run -client ## Restarts the webapp.
2016-03-18 12:46:57 -04:00
2017-12-20 14:49:45 -05:00
run-job-server : ## Runs the background job server.
2017-05-18 15:05:57 -04:00
@echo Running job server for development
2024-01-08 09:47:24 -05:00
$( GO) run $( GOFLAGS) -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' $( PLATFORM_FILES) jobserver &
2017-05-18 15:05:57 -04:00
2017-12-20 14:49:45 -05:00
config-ldap : ## Configures LDAP.
2017-11-03 11:45:19 -04:00
@echo Setting up configuration for local LDAP
2024-07-08 02:16:09 -04:00
# Check if jq is installed
@jq --version > /dev/null 2>& 1 || ( echo "jq is not installed. Please install jq to continue." && exit 1)
2024-07-24 05:02:47 -04:00
$( eval TMPDIR := $( shell mktemp -d) )
2024-07-08 02:16:09 -04:00
jq --slurp '.[0] * .[1]' ${ CONFIG_FILE_PATH } build/docker/keycloak/ldap.mmsettings.json > ${ TMPDIR } /config.json
cp ${ TMPDIR } /config.json ${ CONFIG_FILE_PATH }
rm ${ TMPDIR } /config.json
2017-11-03 11:45:19 -04:00
2024-04-03 15:01:33 -04:00
config-saml : ## Configures SAML.
@echo Setting up configuration for local SAML with keycloak, please ensure your keycloak is running on http://localhost:8484
2024-07-08 02:16:09 -04:00
# Check if jq is installed
@jq --version > /dev/null 2>& 1 || ( echo "jq is not installed. Please install jq to continue." && exit 1)
@cp build/docker/keycloak/keycloak.crt ./config/saml-idp.crt
2024-07-24 05:02:47 -04:00
$( eval TMPDIR := $( shell mktemp -d) )
2024-07-08 02:16:09 -04:00
jq --slurp '.[0] * .[1]' ${ CONFIG_FILE_PATH } build/docker/keycloak/saml.mmsettings.json > ${ TMPDIR } /config.json
cp ${ TMPDIR } /config.json ${ CONFIG_FILE_PATH }
rm ${ TMPDIR } /config.json
config-openid : ## Configures OpenID.
@echo Setting up configuration for local OpenID with keycloak, please ensure your keycloak is running on http://localhost:8484
# Check if jq is installed
@jq --version > /dev/null 2>& 1 || ( echo "jq is not installed. Please install jq to continue." && exit 1)
2024-07-24 05:02:47 -04:00
$( eval TMPDIR := $( shell mktemp -d) )
2024-07-08 02:16:09 -04:00
jq --slurp '.[0] * .[1]' ${ CONFIG_FILE_PATH } build/docker/keycloak/openid.mmsettings.json > ${ TMPDIR } /config.json
cp ${ TMPDIR } /config.json ${ CONFIG_FILE_PATH }
rm ${ TMPDIR } /config.json
@echo Finished setting up configuration for local OpenID with keycloak
2024-04-03 15:01:33 -04:00
2023-08-17 10:16:16 -04:00
config-reset : ## Resets the config/config.json file to the default production values.
@echo Resetting configuration to production default
2017-11-03 11:45:19 -04:00
rm -f config/config.json
2025-08-29 11:01:12 -04:00
OUTPUT_CONFIG = $( PWD) /config/config.json $( GO) run $( GOFLAGS) -tags production ./scripts/config_generator
2017-11-03 11:45:19 -04:00
2019-08-29 16:44:13 -04:00
diff-config : ## Compares default configuration between two mattermost versions
@./scripts/diff-config.sh
2022-01-19 23:37:27 -05:00
clean : stop -docker ## Clean up everything except persistent server data.
2016-03-18 12:46:57 -04:00
@echo Cleaning
rm -Rf $( DIST_ROOT)
2019-11-26 13:37:41 -05:00
$( GO) clean $( GOFLAGS) -i ./...
2016-03-18 12:46:57 -04:00
2016-03-24 09:34:35 -04:00
cd $( BUILD_WEBAPP_DIR) && $( MAKE) clean
2015-07-27 09:48:35 -04:00
2022-05-05 12:12:31 -04:00
find . -type d -name data | xargs rm -rf
2016-03-18 12:46:57 -04:00
rm -rf logs
rm -f mattermost.log
2017-09-25 15:02:41 -04:00
rm -f mattermost.log.jsonl
2016-05-13 16:17:07 -04:00
rm -f npm-debug.log
2016-03-18 12:46:57 -04:00
rm -f .prepare-go
2016-05-20 09:40:52 -04:00
rm -f cover.out
rm -f ecover.out
rm -f *.out
rm -f *.test
2023-03-22 17:22:27 -04:00
rm -f channels/imports/imports.go
2018-05-17 22:24:49 -04:00
rm -f cmd/mattermost/cprofile*.out
2016-03-18 12:46:57 -04:00
2019-07-01 07:44:26 -04:00
nuke : clean clean -docker ## Clean plus removes persistent server data.
2016-03-18 12:46:57 -04:00
@echo BOOM
2015-07-27 09:48:35 -04:00
2016-03-18 12:46:57 -04:00
rm -rf data
2022-06-20 02:33:34 -04:00
rm -f go.work go.work.sum
2015-07-27 09:48:35 -04:00
2017-12-20 14:49:45 -05:00
setup-mac : ## Adds macOS hosts entries for Docker.
2016-03-18 12:46:57 -04:00
echo $$ ( boot2docker ip 2> /dev/null) dockerhost | sudo tee -a /etc/hosts
2017-01-02 20:24:03 -05:00
2019-06-03 17:10:08 -04:00
update-dependencies : ## Uses go get -u to update all the dependencies while holding back any that require it.
2019-04-10 10:56:17 -04:00
@echo Updating Dependencies
2022-05-10 04:29:51 -04:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2024-01-08 09:47:24 -05:00
@echo Enterprise repository detected, temporarily removing external_imports.go
mv enterprise/external_imports.go enterprise/external_imports.go.orig
2022-11-16 22:57:08 -05:00
e n d i f
2019-04-10 10:56:17 -04:00
# Update all dependencies (does not update across major versions)
2020-02-03 11:19:38 -05:00
$( GO) get -u ./...
2019-04-10 10:56:17 -04:00
2021-03-25 05:15:13 -04:00
# Tidy up
$( GO) mod tidy
2022-05-10 04:29:51 -04:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2024-01-08 09:47:24 -05:00
mv enterprise/external_imports.go.orig enterprise/external_imports.go
2022-11-16 22:57:08 -05:00
e n d i f
2019-12-10 07:10:35 -05:00
vet : ## Run mattermost go vet specific checks
2025-09-10 09:11:32 -04:00
$( GO) install github.com/mattermost/mattermost-govet/v2@7d8db289e508999dfcac47b97c9490a0fec12d66
2026-01-09 13:23:16 -05:00
$( GO) vet -vettool= $( GOBIN) /mattermost-govet \
-structuredLogging \
-inconsistentReceiverName \
-emptyStrCmp \
-tFatal \
-configtelemetry \
-errorAssertions \
-requestCtxNaming \
-license \
-inconsistentReceiverName.ignore= session_serial_gen.go,team_member_serial_gen.go,user_serial_gen.go,utils_serial_gen.go \
-noSelectStar \
./...
MM-64878: FIPS Build (#33809)
* pin to ubuntu-24.04
* always use FIPS compatible Postgres settings
* use sha256 for remote cluster IDs
* use sha256 for client config hash
* rework S3 backend to be FIPS compatible
* skip setup-node during build, since already in container
* support FIPS builds
* Dockerfile for FIPS image, using glibc-openssl-fips
* workaround entrypoint inconsistencies
* authenticate to DockerHub
* fix FIPS_ENABLED, add test-mmctl-fips
* decouple check-mattermost-vet from test/build steps
* fixup! decouple check-mattermost-vet from test/build steps
* only build-linux-amd64 for fips
* rm entrypoint workaround
* tweak comment grammar
* rm unused Dockerfile.fips (for now)
* ignore gpg import errors, since would fail later anyway
* for fips, only make package-linux-amd64
* set FIPS_ENABLED for build step
* Add a FIPS-specific list of prepackaged plugins
Note that the names are still temporary, since they are not uploaded to
S3 yet. We may need to tweak them when that happens.
* s/golangci-lint/check-style/
This ensures we run all the `check-style` checks: previously,
`modernize` was missing.
* pin go-vet to @v2, remove annoying comment
* add -fips to linux-amd64.tz.gz package
* rm unused setup-chainctl
* use BUILD_TYPE_NAME instead
* mv fips build to enterprise-only
* fixup! use BUILD_TYPE_NAME instead
* temporarily pre-package no plugins for FIPS
* split package-cleanup
* undo package-cleanup, just skip ARM, also test
* skip arm for FIPS in second target too
* fmt Makefile
* Revert "rm unused Dockerfile.fips (for now)"
This reverts commit 601e37e0fff7b7703540bb9e91961ad8bb83b2e7.
* reintroduce Dockerfile.fips and align with existing Dockerfile
* s/IMAGE/BUILD_IMAGE/
* bump the glibc-openssl-fips version
* rm redundant comment
* fix FIPS checks
* set PLUGIN_PACKAGES empty until prepackaged plugins ready
* upgrade glibc-openssl-fips, use non-dev version for final stage
* another BUILD_IMAGE case
* Prepackage the FIPS versions of plugins
* relocate FIPS_ENABLED initialization before use
* s/Config File MD5/Config File Hash/
* Update the FIPS plugin names and encode the + sign
* add /var/tmp for local socket manipulation
---------
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-09-15 09:53:28 -04:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2022-06-09 05:45:17 -04:00
ifneq ( $( MM_NO_ENTERPRISE_LINT) ,true)
2025-09-10 09:11:32 -04:00
$( GO) vet -vettool= $( GOBIN) /mattermost-govet -structuredLogging -inconsistentReceiverName -emptyStrCmp -tFatal -configtelemetry -errorAssertions -requestCtxNaming -enterpriseLicense $( BUILD_ENTERPRISE_DIR) /...
2022-06-09 05:45:17 -04:00
endif
2020-01-07 06:37:57 -05:00
e n d i f
2017-02-09 16:39:15 -05:00
2023-10-16 10:27:43 -04:00
vet-api : export GO := $( GO )
vet-api : export GOBIN := $( GOBIN )
vet-api : export ROOT := $( ROOT )
vet-api : ## Run mattermost go vet to verify api4 documentation, currently not passing
2025-09-10 09:11:32 -04:00
$( GO) install github.com/mattermost/mattermost-govet/v2@7d8db289e508999dfcac47b97c9490a0fec12d66
2023-10-16 10:27:43 -04:00
make -C ../api build
./scripts/vet-api-check.sh
2022-01-07 09:32:54 -05:00
gen-serialized : export LICENSE_HEADER :=$( LICENSE_HEADER )
2020-08-13 03:35:57 -04:00
gen-serialized : ## Generates serialization methods for hot structs
# This tool only works at a file level, not at a package level.
2021-01-29 03:31:13 -05:00
# There will be some warnings about "unresolved identifiers",
# but that is because of the above problem. Since we are generating
# methods for all the relevant files at a package level, all
# identifiers will be resolved. An alternative to remove the warnings
# would be to temporarily move all the structs to the same file,
2021-01-24 23:58:26 -05:00
# but that involves a lot of manual work.
2022-01-07 09:32:54 -05:00
$( GO) install github.com/tinylib/msgp@v1.1.6
2024-09-16 18:44:32 -04:00
$( GOBIN) /msgp -file= ./public/model/utils.go -tests= false -o= ./public/model/utils_serial_gen.go
@echo " $$ LICENSE_HEADER " > tmp.go
@cat ./public/model/utils_serial_gen.go >> tmp.go
@mv tmp.go ./public/model/utils_serial_gen.go
2023-05-10 12:07:02 -04:00
$( GOBIN) /msgp -file= ./public/model/session.go -tests= false -o= ./public/model/session_serial_gen.go
2022-01-07 09:32:54 -05:00
@echo " $$ LICENSE_HEADER " > tmp.go
2023-05-10 12:07:02 -04:00
@cat ./public/model/session_serial_gen.go >> tmp.go
@mv tmp.go ./public/model/session_serial_gen.go
$( GOBIN) /msgp -file= ./public/model/user.go -tests= false -o= ./public/model/user_serial_gen.go
2022-01-07 09:32:54 -05:00
@echo " $$ LICENSE_HEADER " > tmp.go
2023-05-10 12:07:02 -04:00
@cat ./public/model/user_serial_gen.go >> tmp.go
@mv tmp.go ./public/model/user_serial_gen.go
$( GOBIN) /msgp -file= ./public/model/team_member.go -tests= false -o= ./public/model/team_member_serial_gen.go
2022-01-07 09:32:54 -05:00
@echo " $$ LICENSE_HEADER " > tmp.go
2023-05-10 12:07:02 -04:00
@cat ./public/model/team_member_serial_gen.go >> tmp.go
@mv tmp.go ./public/model/team_member_serial_gen.go
2020-08-13 03:35:57 -04:00
2017-12-20 14:49:45 -05:00
todo : ## Display TODO and FIXME items in the source code.
2022-05-05 12:12:31 -04:00
@! ag --ignore Makefile --ignore-dir runtime '(TODO|XXX|FIXME|"FIX ME")[: ]+'
2017-01-02 20:24:03 -05:00
i f e q ( $( BUILD_ENTERPRISE_READY ) , t r u e )
2023-03-22 17:22:27 -04:00
@! ag --ignore Makefile --ignore-dir runtime '(TODO|XXX|FIXME|"FIX ME")[: ]+' $( BUILD_ENTERPRISE_DIR) /
2017-01-02 20:24:03 -05:00
e n d i f
2017-12-20 14:49:45 -05:00
2023-06-05 06:42:55 -04:00
mmctl-build : ## Compiles and generates the mmctl binary
2023-10-20 05:23:05 -04:00
go build -trimpath -ldflags '$(MMCTL_LDFLAGS)' -o bin/mmctl ./cmd/mmctl
2023-06-05 06:42:55 -04:00
mmctl-docs : ## Generate the mmctl docs
rm -rf ./cmd/mmctl/docs
cd ./cmd/mmctl && go run mmctl.go docs
2022-01-19 23:37:27 -05:00
## Help documentation à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
2017-12-20 14:49:45 -05:00
help :
2019-08-09 10:22:33 -04:00
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2020-07-13 16:29:39 -04:00
@echo
@echo You can modify the default settings for this Makefile creating a file config.mk based on the default-config.mk
@echo
2022-06-21 02:34:36 -04:00
migrations-extract :
@echo Listing migration files
2024-08-09 05:17:15 -04:00
@echo "# Autogenerated file to synchronize migrations sequence in the PR workflow, please do not edit." > channels/db/migrations/migrations.list
2023-03-22 17:22:27 -04:00
find channels/db/migrations -maxdepth 2 -mindepth 2 | sort >> channels/db/migrations/migrations.list
2023-08-16 03:09:11 -04:00
2025-02-19 04:18:07 -05:00
test-local-filestore : # Run tests for local filestore
$( GO) test ./platform/shared/filestore -run '^TestLocalFileBackend' -v