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

Add plugin helper functions #951

Merged
merged 6 commits into from
Jan 26, 2023
Merged

Conversation

mszostok
Copy link
Contributor

@mszostok mszostok commented Jan 23, 2023

Description

Changes proposed in this pull request:

  • Add plugin helper functions

They should simplify Botkube plugins development. First use: https://github.com/kubeshop/botkube-plugins-template/pull/7/files

(Some functions are opinionated as a given approach is required, e.g. ParseCommand)

I created it for 2 reason:

  • After creating 3rd plugin I see that I repeat the same things, again and again. I don't want to maintain my own project with helper functions as IMO they fit nicely into Botkube.
  • The blog post that I created for gh is more readable as we focus more on the core logic instead of some repeatable work like downloading or running binaries.

However, if @botkube-dev you think that is sth that shouldn't be in our repository. I will extract that to a separate one under my GitHub handle.

Related issue(s)

#925

Copy link
Member

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

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

The ParseCommand + MergeConfigs helpers could be useful, but I think the other ones don't belong here. They doesn't seem to be generic enough, and also use some shortucts like harcoded paths or modifying envs for current process. The DownloadDependencies will be not necessary anymore on Feburary 6th so I wouldn't keep it as official helper.

I think the solutions you provided are totally fine for the example executor purpose, so let's move most of the code there. In pluginx I would put something we actually use for our plugins.

We can discuss it offline, but please see my comments first 👍

internal/plugin/manager.go Show resolved Hide resolved
pkg/pluginx/bin.go Outdated Show resolved Hide resolved
pkg/pluginx/command.go Show resolved Hide resolved
pkg/pluginx/command.go Show resolved Hide resolved
pkg/pluginx/command.go Outdated Show resolved Hide resolved
pkg/pluginx/command.go Outdated Show resolved Hide resolved
@mszostok mszostok force-pushed the plugin-helpers branch 3 times, most recently from e9799c2 to 2777f11 Compare January 25, 2023 19:31
@mszostok
Copy link
Contributor Author

I applied all fixed discussed offline. Once this PR will be merged, I will update our tutorials

@mszostok mszostok requested a review from pkosiec January 25, 2023 19:37
Copy link
Member

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

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

LGTM 👌 Good work!

pkg/pluginx/command.go Show resolved Hide resolved
@mszostok mszostok merged commit 7d26b6d into kubeshop:main Jan 26, 2023
@mszostok mszostok deleted the plugin-helpers branch January 26, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants