Skip to content

feat: CLI plugins SDK #2091

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

Merged
merged 46 commits into from
Jul 1, 2025

Conversation

gr0
Copy link
Collaborator

@gr0 gr0 commented Jun 4, 2025

This is an experimental approach to #2090 - the part of the whole solution providing the framework part.

I also created an example plugin that can be used for testing https://github.com/gr0/chainloop_example_plugin - everything that is needed is described in the readme file of the plugin.

Fixes #2091

Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 requested review from migmartri and jiparis June 4, 2025 14:58
gr0 added 3 commits June 4, 2025 21:13
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Copy link
Member

@jiparis jiparis left a comment

Choose a reason for hiding this comment

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

Thanks @gr0 . This is looking great. I've left a couple of comments.

gr0 added 3 commits June 9, 2025 22:45
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 force-pushed the add-experimental-support-for-cli-plugins branch from 67c1add to 3d0f5da Compare June 9, 2025 20:48
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 force-pushed the add-experimental-support-for-cli-plugins branch from 3d0f5da to 9b9ae91 Compare June 9, 2025 20:48
@gr0 gr0 marked this pull request as draft June 10, 2025 13:19
gr0 added 4 commits June 10, 2025 22:43
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 force-pushed the add-experimental-support-for-cli-plugins branch from 909a8df to 2366269 Compare June 10, 2025 20:43
@gr0 gr0 marked this pull request as ready for review June 11, 2025 19:44
gr0 added 3 commits June 12, 2025 08:24
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0
Copy link
Collaborator Author

gr0 commented Jun 27, 2025

In the end, how are we passing the configuration? I can't see it in the PR

Have a look at the following piece of code:

result, err := action.NewPluginExec(actionOpts, pluginManager).Run(ctx, plugin.Metadata.Name, cmdInfo.Name, config)
if err != nil {
	return fmt.Errorf("failed to execute plugin command: %w", err)
}

We are passing the configuration here.

gr0 added 8 commits June 27, 2025 22:42
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 requested a review from migmartri June 28, 2025 08:37
@migmartri
Copy link
Member

In the end, how are we passing the configuration? I can't see it in the PR

Have a look at the following piece of code:

result, err := action.NewPluginExec(actionOpts, pluginManager).Run(ctx, plugin.Metadata.Name, cmdInfo.Name, config)
if err != nil {
	return fmt.Errorf("failed to execute plugin command: %w", err)
}

We are passing the configuration here.

Is that configuration the CA/CP APIs/CAs, current org and so on?

Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0
Copy link
Collaborator Author

gr0 commented Jun 30, 2025

In the end, how are we passing the configuration? I can't see it in the PR

Have a look at the following piece of code:

result, err := action.NewPluginExec(actionOpts, pluginManager).Run(ctx, plugin.Metadata.Name, cmdInfo.Name, config)
if err != nil {
	return fmt.Errorf("failed to execute plugin command: %w", err)
}

We are passing the configuration here.

Is that configuration the CA/CP APIs/CAs, current org and so on?

Yes, it includes the current organization, the token and so on.

gr0 added 6 commits June 30, 2025 13:35
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
…m from cobra command

Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 requested a review from migmartri July 1, 2025 13:54
Copy link
Member

@migmartri migmartri left a comment

Choose a reason for hiding this comment

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

In general LGTM, just make sure to rebase and take a look at my comment w.r.t the config behavior.

Thanks!

@migmartri migmartri changed the title #2090 - Introduce extensibility to Chainloop CLI feat: CLI plugins SDK Jul 1, 2025
gr0 added 3 commits July 1, 2025 22:02
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
Signed-off-by: Rafał Kuć <r.kuc@solr.pl>
@gr0 gr0 merged commit 457f25a into chainloop-dev:main Jul 1, 2025
13 checks passed
@gr0 gr0 deleted the add-experimental-support-for-cli-plugins branch July 1, 2025 20:28
@migmartri
Copy link
Member

performing a release! 🎉

@gr0
Copy link
Collaborator Author

gr0 commented Jul 1, 2025

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants