Commit Graph

49 Commits

Author SHA1 Message Date
Jesse Hallam
b05093d508 Source available metrics (#24879)
* Expose metrics under a source available license

* do not assume Cluster()

* allow metrics if licensed or dev

* temporary vet override

* simplify BULID_TAGS handling

* auto clean old imports.go

* fix license listener

* e2e test metrics & license semantics

* update from enterprise

* switch back to mattermost-govet/v2@new now

* update metrics from upstream

* Update license_spec.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update license_spec.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update e2e-tests/cypress/tests/integration/channels/enterprise/metrics/license_spec.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update e2e-tests/cypress/tests/integration/channels/enterprise/metrics/license_spec.js

* split up specs

* require/delete license earlier in e2e test

* expanded expect to debug failures

* more logging

* Revert "more logging"

This reverts commit 0bc513fd92.

* e2e: try deleting license first

* update from enterprise

* toggleMetricsOn to work around license delete

* eslint

* ensure admin before deleting license

* update from enterprise

* updates from enterprise

* fix cypress logging

* temp: log at DEBUG for Cypress tests

---------

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-08 10:47:24 -04:00
Matthew Straughn
ebdc964161 Mm 16623 fix all initialism errors in channels/app and channels/api4 dir (#25743)
* updated go mod and sum files

* fixed var-naming errors in channels/app and channels/api4 dir

* Revert "updated go mod and sum files"

This reverts commit 088dd00a84.

* renamed a cost .
2023-12-20 06:46:54 +01:00
Agniva De Sarker
b946dad78d MM-55987: Bypass uploading to S3 for local mode mmctl import (#25591)
We directly instruct the server to read from the local filesystem
in case the local_mode key is set.

There is now no need to upload the file in --local mode and a warning
is thrown accordingly.

https://mattermost.atlassian.net/browse/MM-55987

```release-note
Now the mmctl bulk import process command in local mode supports processing an import file without actually uploading it to the server. Simply pass the file path to the import file and the server will directly read from it, and pass the --bypass-upload flag. There is no need to use the import upload command. NOTE: all of this is applicable only in local mode.
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-12-13 09:38:00 +05:30
Ben Schumacher
5b6b425cfc [MM-56061] Only render where field in model.AppError when it's present (#25648)
* Only render where field in model.AppError when it's present

* Remove trailing comma from permission error
2023-12-11 10:27:51 +01:00
Joram Wilander
e0a36cf60a mmctl: add listing oauth apps (#25497)
* mmctl: add listing oauth apps

* Fix tests

* Update mmctl docs

* Fix tests

* Update server/cmd/mmctl/commands/oauth.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

* Update server/cmd/mmctl/commands/oauth.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

* Add paging

* Update docs

---------

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2023-12-05 12:25:35 -05:00
Ben Schumacher
b2ec1ff8ae [MM-55595] Use annotated logger in search layer (#25468) 2023-12-04 18:34:57 +01:00
Ben Schumacher
0a38042d58 [MM-55739] Allow admins to pipe the output of mmctl websocket into JSON parser (#25545) 2023-11-27 12:45:32 +01:00
Carrie Warner (Mattermost)
91a7639c3c Updated mmctl export create command flag (#25474)
* Updated export create flag

* Update server/cmd/mmctl/docs/mmctl_export_create.rst

* Updated mmctl export create command flags
2023-11-23 08:58:34 -05:00
Ben Schumacher
5e94af1302 [MM-54852] Add mmctl command to download Support Packet (#25419)
* Add mmctl command to download Support Packet

* Simplify file name

* Revert "Simplify file name"

This reverts commit 17084a3350.

* Fix docs
2023-11-21 15:25:01 +01:00
Aldrin
2ff946e79b chore: remove deprecated "io/ioutil" imports (#25119)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2023-11-16 12:15:30 +01:00
KIMBOH LOVETTE
29cd6177c0 [GH-21565]-Add the request context and logger to all public methods in server/channels/app/audit.go (#25368) 2023-11-14 13:34:47 +01:00
Jesse Hallam
48bf4e9bd8 Fix issue 25390 (#25403) 2023-11-10 21:55:33 -04:00
Paul Vrn
dd46afacd6 [MM-55004] Add warning log message when app run as root (#25213)
* feat: add log warn when app is run as root user

* Modify warning message

* Move warning message condition to L415

* move check to cmd/mattermost/main.go

* Update server/channels/app/server.go

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>

* Moved checkForRootUser to root.go

* format root.go

* remove unnecessary space

---------

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-11-08 11:39:37 +01:00
Ben Schumacher
486e836b83 Fix racy test issues (#24971) 2023-11-06 12:26:17 +01:00
Catena cyber
04e7b6bc9e Applies perfsprint linter (#24999)
Replacing usages of fmt.Sprint with faster alternatives

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>
2023-11-03 11:18:18 +01:00
Neto Costa
00108d44bb [MM-47821]: fix searchUserCmdF to return proper errors (#24700)
* fix: fix searchUserCmdF to return proper errors

* fix: fix broken tests

* fix: fix go-ci issues

* fix: fix more broken tests

* fix: fix wrong function call on error getting user test

* fix: fix e2e test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-10-25 14:56:12 -04:00
Ben Schumacher
22c9c80cd2 [MM-54929] Revert "Remove unnecessary mmctl enterprise deps (#24395)" (#25063)
* Revert "Remove unnecessary mmctl enterprise deps (#24395)"

This reverts commit 32512d35fb.

* Add comment
2023-10-24 10:51:38 +02:00
Ben Schumacher
86b965a3c4 [MM-53256] Use buildinfo instead of env variables for mmctl (#23794) 2023-10-20 11:23:05 +02:00
Ben Schumacher
13c05a571f Migrate store methods to use request.Context instead of context.Context (#24836) 2023-10-11 13:08:55 +02:00
Ben Schumacher
0d5a8b8841 Add whitespace linter (#24855) 2023-10-11 10:13:36 +02:00
Miguel de la Cruz
f18002a8d6 Add a simple mmctl README file (#23638)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2023-10-10 10:34:08 +02:00
Jesse Hallam
47bfa2b66b Pass a logger instead of embedding on job (#24650)
* pass a logger instead of embedding on job

* leverage mlog.Millis

* use worker logger with HandleJobPanic

* rely on existing LogClone instead

* guard Job.LogClone against nil Job

* s/workername/worker_name

* Revert "rely on existing LogClone instead"

This reverts commit 17303cbac9.

* Revert "guard Job.LogClone against nil Job"

This reverts commit f1ae22dee5.
2023-10-09 11:04:55 -03:00
Ben Schumacher
aad25be4e1 [MM-54434] Use job.Logger to capture ldap logs (#24493) 2023-10-06 22:43:21 +02:00
Agniva De Sarker
acdfefe456 Revert "MM-53879: Fix recursive loading of license (#24200)" (#24498)
This reverts commit dd73c2af0f.
2023-09-07 20:58:20 +05:30
Ben Schumacher
30b12f199b [MM-54132] Use annotated logger for log messages from jobs (#24275) 2023-09-07 08:50:22 +02:00
Felipe Martin
9f7521d003 Move request package into public/shared folder (#24420)
* move request package to public/shared

* updated app-layers

* update app layer

* remove original package location
2023-09-05 09:47:30 +02:00
Jian Lim
8c2fc88471 Refactor: func StringInSlice to slices.Contains (#24262)
* Refactor: Use generic to change func StringInSlice to Contains

* Refactor: Use generic to change func stringNotInSlice to Contains

Make utils.go (dir server/public/utils) and func Contains

* Refactor: Move func Contains from channels/utils to public/utils

Move func Contains from channels/utils to public/utils

Fix import declarations line

* Docs: Add a description of the Contains function

* Test: add TestContains

Add a test code for a Contain function
2023-09-01 12:35:27 +05:30
Agniva De Sarker
32512d35fb Remove unnecessary mmctl enterprise deps (#24395)
```release-note
NONE
```
2023-08-31 10:32:28 +02:00
Ben Schumacher
4790a60369 Fix gotestsum configuration for mmctl tests (#24354) 2023-08-28 14:01:14 +02:00
Julien Tant
9d569df9b4 [MM-22133] Allow exporting and importing archived channels (#23724) 2023-08-25 17:55:47 -07:00
Agniva De Sarker
dd73c2af0f MM-53879: Fix recursive loading of license (#24200)
There were multiple problems with loading of a license.

1. It was called from inside app/server.go and app/platform/service.go. The first one wasn't really needed anymore, so we remove it.

2. To make loading of a license work across a cluster, the license load action was attached along with the `InvalidateAllCachesSkipSend` method. But the problem with that was that it would even get called in the caller node as well, putting it in a recursive loop.

```
LoadLicense -> SaveLicense -> InvalidateAllCaches -> InvalidateAllCachesSkipSend -> LoadLicense
```

To fix this, we create a dedicated loadLicense cluster event and move it away from the `InvalidateAllCachesSkipSend` method. And then from the caller side, we just trigger this action.

3. We also remove the first call to check license expiration which would load the license again. This is unnecessary because if the license is expired, server wouldn't start at all.

While here, we also make some other improvements like removing unnecessary goroutine spawning while publishing websocket events. They are already handled asynchronously, so there is no need
to create a goroutine for that.

We also remove

```
ps.ReloadConfig()
ps.InvalidateAllCaches()
```

from requestTrialLicense as they are already called from inside `*PlatformService.SaveLicense`.

And lastly, we remove the `*model.AppError` return from `*PlatformService.InvalidateAllCaches` because there was nothing to return at all.

https://mattermost.atlassian.net/browse/MM-53879

```release-note
Fix several issues with loading of a license
```
2023-08-21 20:17:16 +05:30
Nathan
44f3482fee Trims whitespace from command arguments in RootCmd (#24218)
- Prevents commands from receiving potential whitespace characters
- Adds a new root test case ensuring various whitespace characters are removed

Co-authored-by: Nathan Geist <ngeist@spiria.com>
2023-08-17 10:19:09 +02:00
Jesse Hallam
e39b485c4b Fail vs. fatal on store startup (#24170)
If the store fails to initialize (e.g. run a migration), it would `log.Fatal` and then `os.Exit`. Unfortunately, this trips up `TestMain`, which happily keeps running tests, now guaranteed to fail.

Avoid this by instead returning an error from the store initialization, handling appropriately at the layer above.
2023-08-04 23:05:01 -03:00
Julien Tant
077c16ef61 [MM-53454] Add export file settings + slash command for public link (#23915)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-19 13:01:39 -07:00
Miguel de la Cruz
150c6e7aef Remove boards product references (#23855)
Automatic Merge
2023-07-18 15:17:29 +03:00
Ibrahim Serdar Acikgoz
de61b9b687 [MM-53113] cmd/mattermost/db: remove app dependency from db reset command (#23727) 2023-06-16 15:36:41 +03:00
Miguel de la Cruz
44a99d1736 Move playbooks to plugin (#23732)
* Remove build references

* Remove playbooks webapp and server, and add the prepackaged plugin

* Remove translations

* Add ProductSettings to the playwright type

* Restore playbooks as a prepackaged plugin for cypress e2e tests
2023-06-14 23:33:26 +02:00
Agniva De Sarker
c249ba4a66 MM-52532: Fix golangci warnings (#23709)
https://mattermost.atlassian.net/browse/MM-52532

- Replace golint with revive
- Add makezero linter
- Fix all the required linter failures

Some issues in enterprise and public modules
are yet to be fixed. We send this to expediate things.
2023-06-13 14:08:36 +05:30
Ibrahim Serdar Acikgoz
4546a2eebb [MM-47976] cmd/mattermost/db: add downgrade commands and enable plan saving (#21779) 2023-06-12 12:48:50 +03:00
Agniva De Sarker
efaa6264cc MM-53032: Fix module path after repo rename (#23689)
It was a good decision in hindsight to keep the public module as 0.x
because this would have been a breaking change again.

https://mattermost.atlassian.net/browse/MM-53032
```release-note
Changed the Go module path from github.com/mattermost/mattermost-server/server/v8 to github.com/mattermost/mattermost/server/v8.

For the public facing module, it's path is also changed from github.com/mattermost/mattermost-server/server/public to github.com/mattermost/mattermost/server/public
```
2023-06-11 10:54:35 +05:30
Ben Schumacher
6c82605df0 [MM-49989] Pass a context.Context to Client4 methods (#22922)
* Migrate all method in model/client4.go to accept a context.Context

* Fix th.*Client

* Fix remaining issues

* Empty commit to triger CI

* Fix test

* Add cancellation test

* Test that returned error is context.Canceled

* Fix bad merge

* Update mmctl code

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-06 23:29:29 +02:00
Miguel de la Cruz
951456c780 Includes mmctl into the mono-repo (#23091)
* Includes mmctl into the mono-repo

* Update to use the new public module paths

* Adds docs check to the mmctl CI

* Fix public utils import path

* Tidy up modules

* Fix linter

* Update CI tasks to use the new file structure

* Update CI references
2023-06-05 12:42:55 +02:00
Jesse Hallam
bb02b35048 Expose public/ API as submodule (#23345)
* model -> public/model

* plugin -> public/plugin

* public/model/utils -> public/utils

* platform/shared/mlog -> public/shared/mlog

* platform/shared/i18n -> public/shared/i18n

* platform/shared/markdown -> public/shared/markdown

* platform/services/timezones -> public/shared/timezones

* channels/einterfaces -> einterfaces

* expose public/ submodule

* go mod tidy

* .github: cache-dependency-path, setup-go-work

* modules-tidy for public/ too

* remove old gomodtidy
2023-05-10 13:07:02 -03:00
Jesse Hallam
f28a2bcca7 server/public/ -- pre-requisite changes (#23278)
* invert depdendency: filestore -> model

* markdown: nolint:misspell

* inline jsonutils within model

* push model.GetInfoForBytes -> channels/app

* push channel/utils.CompileGo* -> plugin/utils

* push plugin/scheduler -> channels/jobs/plugins

* push utils.Copy(File|Dir) -> model

* oauthproiders/gitlab -> channels/app/oauthproviders/gitlab

* decouple plugin from einterfaces.MetricsInterface

* fix TestGetInfoForFile

* Revert "Run golangci in server CI (#23240)"

This reverts commit 349e5d4573.

* add model/utils

---------

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2023-05-09 13:30:02 -03:00
Agniva De Sarker
9f1796f98b Remove unnecessary blank imports (round 2) (#23310)
I mistakenly assumed that those packages are naturally imported.

And also atleast one test would have broken.

None of them are true. :)

So we just import it again at a better place

This reverts commit 30a053314b.

```release-note
NONE
```
2023-05-05 19:44:02 +05:30
Miguel de la Cruz
067e36c23c Enable products for tests (#22757)
* Enable products for channels tests

* increase unit test timeout; check IsConfigReadOnly

* make app-layers

* Avoid loading boards tempaltes between tests to improve speed

* Fix delete query to be compatible with both databases

* Avoid preserving the templates for boards store tests

* Run all tests in one command

* Revert "Run all tests in one command"

This reverts commit 0330f7cd8f.

* concurrent pkg group tests in CI

* Revert "Revert "Run all tests in one command""

This reverts commit 73892fec77.

* Revert "concurrent pkg group tests in CI"

This reverts commit 550fb6cdd4.

* try testing 3 subsets of packages concurrently to improve time taken

* Revert "try testing 3 subsets of packages concurrently to improve time taken"

This reverts commit 97475f3c4e.

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: wiggin77 <wiggin77@warpmail.net>
2023-04-18 13:58:33 +02:00
Agniva De Sarker
b200a07881 v8.0 module release (#22975)
https://mattermost.atlassian.net/browse/MM-52079

```release-note
We upgrade the module version to 8.0. The new module path is github.com/mattermost-server/server/v8.
```


Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2023-04-18 11:05:28 +05:30
Jesse Hallam
4b7f6cb974 bind to localhost:0 for tests (#22839)
* bind to localhost:0 for tests

Explicitly bind to `localhost:0` instead of just `:0` to avoid binding to all available interfaces and in turn avoid triggering firewall warnings on MacOS.

* fix Playbooks to use dynamic port

* TestMetrics: handle ipv4 localhost too

* TestMetrics: linting
2023-04-06 09:59:58 -03:00
Doug Lauder
c943ed6859 Mono repo -> Master (#22553)
Combines the following repositories into one:

https://github.com/mattermost/mattermost-server
https://github.com/mattermost/mattermost-webapp
https://github.com/mattermost/focalboard
https://github.com/mattermost/mattermost-plugin-playbooks
2023-03-22 17:22:27 -04:00