Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For non-cloud plugin settings, set hosting property to on-prem #269

Merged
merged 19 commits into from
Jul 26, 2022

Conversation

mickmister
Copy link
Contributor

Summary

This PR makes uses the hosting plugin setting property added by mattermost/mattermost#20677, in order to hide these settings on cloud servers.

Ticket Link

Fixes https://mattermost.atlassian.net/browse/MM-44843

Related Pull Requests

@mickmister mickmister added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Jul 19, 2022
@mickmister mickmister requested a review from DHaussermann July 19, 2022 09:35
@mickmister mickmister requested a review from larkox as a code owner July 19, 2022 09:35
@mickmister
Copy link
Contributor Author

Currently WIP since the source code of the plugin still needs to change to support the correct functionality for both hosting environments

@codecov
Copy link

codecov bot commented Jul 20, 2022

Codecov Report

Merging #269 (f84bb01) into master (8434d19) will not change coverage.
The diff coverage is 0.00%.

@@          Coverage Diff           @@
##           master    #269   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           8       8           
  Lines         882     888    +6     
======================================
- Misses        882     888    +6     
Impacted Files Coverage Δ
server/command.go 0.00% <0.00%> (ø)
server/configuration.go 0.00% <0.00%> (ø)
server/http.go 0.00% <0.00%> (ø)
server/plugin.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8434d19...f84bb01. Read the comment docs.

@mickmister mickmister changed the title WIP: Set hosting to on-prem for non-cloud plugin settings For non-cloud plugin settings, set hosting property to on-prem Jul 20, 2022
@@ -82,7 +82,7 @@ func findManifest() (*model.Manifest, error) {
// we don't want to accidentally clobber anything we won't preserve.
var manifest model.Manifest
decoder := json.NewDecoder(manifestFile)
decoder.DisallowUnknownFields()
Copy link
Contributor Author

@mickmister mickmister Jul 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is commented out to support compiling the plugin with an "unknown" property on the plugin settings. Updating the server version to otherwise support this is not trivial because:

  • The newer mattermost-server commit to import requires Go 1.18 to compile
  • circleci then needs to be updated to use Go 1.18
  • Updating circleci's Go image is blocked by Move to cimg/go circleci-orbs#29
  • I tried to continue the work on that PR, but getting Go 1.18 working on there was non-trivial
  • The golang:1.18-node image also updates the node version, making it so it is a newer version than this plugin currently compiles with

The reason for this DisallowUnknownFields call is to prevent the manifest field structure from being out of sync, which is something that's occurring in this PR. We are purposely "breaking the rules here", while the circleci update is still underway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @hanzei for discussion on this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details on the error I was getting in CI mattermost/circleci-orbs#29 (comment)

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and passed with mattermost/mattermost-webapp#10799 and mattermost/mattermost#20677

  • JWT fields are correctly hidden when using a non Cloud license
  • Tested upgrade case for servers with cloud license
  • Tested that any server with cloud who may have oAuth disabled is seamlessly using oAuth config on upgrade
  • As a precaution ensured that oAuth is still functional on upgrade

@DHaussermann DHaussermann added QA Review Done PR has been approved by QA and removed 3: QA Review Requires review by a QA tester labels Jul 21, 2022
@mickmister mickmister requested a review from catalintomai July 22, 2022 02:47
@@ -47,7 +47,8 @@
"type": "bool",
"help_text": "When true, OAuth will be used as the authentication means with Zoom. \n When false, JWT will be used as the authentication means with Zoom. \n If you're currently using a JWT Zoom application and switch to OAuth, all users will need to connect their Zoom account using OAuth the next time they try to start a meeting. [More information](https://mattermost.gitbook.io/plugin-zoom/installation/zoom-configuration).",
"placeholder": "",
"default": false
"default": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking this default value change is intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larkox Yes it's intended, since the OAuth feature is now our "main" feature offering, and we want to discourage using the JWT method.

@larkox larkox added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Jul 26, 2022
@mickmister mickmister merged commit 38cd3c1 into master Jul 26, 2022
@mickmister mickmister deleted the plugin-setting-hosting-env branch July 26, 2022 15:33
mickmister added a commit that referenced this pull request Aug 5, 2022
* set hosting to on-prem for `Enable OAuth`, `APIKey`, and `APISecret` plugin settings

* use actual server commit

* force oauth to be used when using cloud version of the plugin

* bump go mod version

* test circleci config

* remove references to plugin-ci

* bump Go version in circleci

* use cimg

* add other cimg changes

* go mod tidy

* revert circleci changes

* revert build/go.mod changes so we are using the old server version

* extend manifest struct to support hosting field

* Revert "extend manifest struct to support hosting field"

This reverts commit b862b40.

* revert all go mod changes

* remove manifest field name restriction

* add comment explaining commented out code

* reorder conditions for readability
@mickmister mickmister mentioned this pull request Aug 5, 2022
mickmister added a commit that referenced this pull request Aug 16, 2022
* Cross-plugin task: Enable the CircleCI "test" job in each plugin repo that has a webapp plugin (#237)

Co-authored-by: maisnamrajusingh <[email protected]>

* [MM-223] Fixing Post Permissions Access (#233)

* For non-cloud plugin settings, set hosting property to `on-prem` (#269)

* set hosting to on-prem for `Enable OAuth`, `APIKey`, and `APISecret` plugin settings

* use actual server commit

* force oauth to be used when using cloud version of the plugin

* bump go mod version

* test circleci config

* remove references to plugin-ci

* bump Go version in circleci

* use cimg

* add other cimg changes

* go mod tidy

* revert circleci changes

* revert build/go.mod changes so we are using the old server version

* extend manifest struct to support hosting field

* Revert "extend manifest struct to support hosting field"

This reverts commit b862b40.

* revert all go mod changes

* remove manifest field name restriction

* add comment explaining commented out code

* reorder conditions for readability

* Fix OAuth token refresh (#253)

* avoid refreshing token if an error occurs while fetching current token

* pass in firstConnect bool

* lint

* explicitly assign firstConnect boolean to local variable

* ensure oauth token is decrypted when fetched from the kv store

* rename functions

* wrap account level token refresh in firstConnect block as well

* Cherrypick "Correct docs and cleanup screenshots"

* Revert "Cherrypick "Correct docs and cleanup screenshots""

This reverts commit 7164075.

* preserve access token when saving encrypted version

* use refresh token for check

Co-authored-by: Mattermod <[email protected]>
Co-authored-by: Ben Schumacher <[email protected]>
Co-authored-by: Daniel Espino García <[email protected]>

* bump to 1.6.1

* add GetLicense call in test

* check nil license features (#277)

Co-authored-by: sibasankarnayak <[email protected]>
Co-authored-by: maisnamrajusingh <[email protected]>
Co-authored-by: Jupri Abel <[email protected]>
Co-authored-by: Mattermod <[email protected]>
Co-authored-by: Ben Schumacher <[email protected]>
Co-authored-by: Daniel Espino García <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request QA Review Done PR has been approved by QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants