mattermost / mattermost-developer-documentation

Mattermost developer documentation.
https://developers.mattermost.com
BSD 3-Clause "New" or "Revised" License
79 stars 383 forks source link

Update docs for debugging server plugins #1370

Open mickmister opened 2 months ago

mickmister commented 2 months ago

Summary

Old docs https://developers.mattermost.com/integrate/plugins/developer-workflow/#debug-server-side-plugins-using-delve

New docs http://mattermost-dev-docs-preview-pulls.s3-website-us-east-1.amazonaws.com/1370/integrate/plugins/developer-workflow/#debug-server-side-plugins-using-delve

This PR updates the section on debugging server-side plugins on the Developer Workflow page. There are some changes due to previously having external libraries checked in a vendor folder, which now exist in Go modules.

The PR includes a script to automate modifying the rpc_client.go file in the go-plugin package, to allow for long pauses from the debugger. Note there is an open PR upstream to implement this into the package https://github.com/hashicorp/go-plugin/pull/101, as well as an issue I had opened for this a while ago https://github.com/hashicorp/go-plugin/issues/248. Patching the library locally for development purposes seems harmless to me. I'm wondering if there's a more appropriate way to do this.

Ticket Link

Fixes https://github.com/mattermost/mattermost-developer-documentation/issues/1365

github-actions[bot] commented 2 months ago

Newest code from mickmister has been published to preview environment for Git SHA 055a148b05654fed0539277cc6285b1877409780

github-actions[bot] commented 2 months ago

Newest code from mickmister has been published to preview environment for Git SHA 055a148b05654fed0539277cc6285b1877409780

mickmister commented 2 months ago

If we want to debug the OnActivate function, I think we'll need to run the plugin in attach mode, which allows the plugin to run on its own, and attach itself to the running Mattermost instance. This way, we can attach a debugger to the running plugin before it's interacting with the Mattermost server. This is attach strategy is done in unit testing in other projects https://github.com/mattermost/mattermost-plugin-msteams/blob/fd8798ee2ec005f7de528067d6f1ec863f70ffff/server/helper_test.go#L61

github-actions[bot] commented 2 months ago

Newest code from mickmister has been published to preview environment for Git SHA e7632686082fdebe5f463ae079b6ae4b97b6e1e8

github-actions[bot] commented 1 month ago

Newest code from azigler has been published to preview environment for Git SHA 29bbb9be9e4a3012029bbdd9c5da4d5ddc0a0c3a

github-actions[bot] commented 2 weeks ago

Newest code from azigler has been published to preview environment for Git SHA 9221588f5660d40c7c14f2762244c9d44fdcf6db

mickmister commented 2 weeks ago

Are they just missing? What would be needed to add them?

@azigler Yes they need to be added to the repos as .vscode/launch.json files https://learn.microsoft.com/en-us/microsoft-edge/visual-studio-code/microsoft-edge-devtools-extension/launch-json

azigler commented 2 weeks ago

Are they just missing? What would be needed to add them?

@azigler Yes they need to be added to the repos as .vscode/launch.json files https://learn.microsoft.com/en-us/microsoft-edge/visual-studio-code/microsoft-edge-devtools-extension/launch-json

Could we provide an example file inline in this docs PR?

github-actions[bot] commented 2 weeks ago

Newest code from mickmister has been published to preview environment for Git SHA 2c3a4e1916b36a44f39dcc7f7bdd9849e8bf1651

github-actions[bot] commented 2 weeks ago

Newest code from mickmister has been published to preview environment for Git SHA 99dcd1bf9bef753adfbbcbf3252dfa06355e5dba

mickmister commented 2 weeks ago

Could we provide an example file inline in this docs PR?

@azigler Yeah there's an example launch.json config included in the docs here

https://github.com/mattermost/mattermost-developer-documentation/blob/2c3a4e1916b36a44f39dcc7f7bdd9849e8bf1651/site/content/integrate/plugins/developer-workflow.md?plain=1#L120-L132

github-actions[bot] commented 1 week ago

Newest code from cwarnermm has been published to preview environment for Git SHA 4fa21acd30b2b2fdc0dd32f99a81202997f825de