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

Remove restriction for executable relative file path for nested datasource plugins #1005

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

wbrowne
Copy link
Member

@wbrowne wbrowne commented Jun 11, 2024

What this PR does / why we need it:
For datasource plugins that are nested within an app, today they are required to specify their executable plugin.json field as a file path in parent plugin's folder. (Zabbix, Twinmaker). I don't think we need to be so restrictive, especially since it causes issues with reading these paths on Windows.

Now you can either specify the nested executable field as ../gpx_foo or gpx_foo - both of which will have the same effect. The plan once this PR is merged is that we can remove path information from plugins that are using it - which will fix the issue of building on Windows.

Which issue(s) this PR fixes:
Fixes #980.

Special notes for your reviewer:
There's also a test for backwards compatibility.

@wbrowne wbrowne self-assigned this Jun 11, 2024
@wbrowne wbrowne requested a review from a team as a code owner June 11, 2024 13:29
@wbrowne wbrowne requested review from marefr, andresmgot and xnyo and removed request for a team June 11, 2024 13:29
Comment on lines +36 to +37
if strings.HasPrefix(exe, "../") {
return exe[3:], nil
Copy link
Member Author

Choose a reason for hiding this comment

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

We could just do this instead here:

Suggested change
if strings.HasPrefix(exe, "../") {
return exe[3:], nil
return filepath.Base(exe), nil

Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

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

LGTM

@wbrowne wbrowne requested a review from ryantxu June 12, 2024 13:17
@wbrowne wbrowne merged commit 17ad95b into main Jun 12, 2024
3 checks passed
@wbrowne wbrowne deleted the nested-datasource-build-take-2 branch June 12, 2024 13:37
@wbrowne
Copy link
Member Author

wbrowne commented Jun 13, 2024

Linking this work with this Grafana issue grafana/grafana#83416 (which we can likely close)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Improve building of nested plugins
3 participants