Skip to content

Prepare Plugin SDK#5529

Merged
Warashi merged 10 commits intomasterfrom
plugin-sdk
Feb 13, 2025
Merged

Prepare Plugin SDK#5529
Warashi merged 10 commits intomasterfrom
plugin-sdk

Conversation

@Warashi
Copy link
Member

@Warashi Warashi commented Feb 3, 2025

What this PR does:

This PR adds an SDK for plugin implementation.
The implementation is partial, and I'll send other PRs to implement the rest.

Why we need it:

There are many boilerplates for implementing plugins.

What I want to be reviewed:

The API designs.

The users of this SDK will write codes like the one below.

package main

import (
  ...
)

func main() {
  pipedsdk.RegisterDeploymentPlugin(&pluginImpl{})
  if err := pipedsdk.Run(); err != nil {
     log.Fatal(err) // or some error handling
  }
}

Which issue(s) this PR fixes:

Part of #5530

Does this PR introduce a user-facing change?: No

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
… plugins

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
…ization

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@codecov
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 159 lines in your changes missing coverage. Please review.

Project coverage is 26.33%. Comparing base (cfe6136) to head (e6ebd92).
Report is 34 commits behind head on master.

Files with missing lines Patch % Lines
pkg/plugin/pipedsdk/sdk.go 0.00% 115 Missing ⚠️
pkg/plugin/pipedsdk/deployment.go 0.00% 44 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5529      +/-   ##
==========================================
- Coverage   26.53%   26.33%   -0.20%     
==========================================
  Files         464      467       +3     
  Lines       49917    50066     +149     
==========================================
- Hits        13243    13183      -60     
- Misses      35615    35828     +213     
+ Partials     1059     1055       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…nal identification fields and unimplemented method stubs

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@Warashi Warashi marked this pull request as ready for review February 3, 2025 06:56

// DeploymentPlugin is the interface that be implemented by a full-spec deployment plugin.
// This kind of plugin should implement all methods to manage resources and execute stages.
type DeploymentPlugin[Config any] interface {
Copy link
Member Author

Choose a reason for hiding this comment

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

The Config parameter is the plugin's config defined in piped's config.

Copy link
Member

Choose a reason for hiding this comment

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

Let's add a comment to explain that 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I added config on this commit.
337e8c8


// DeploymentPlugin is the interface that be implemented by a full-spec deployment plugin.
// This kind of plugin should implement all methods to manage resources and execute stages.
type DeploymentPlugin[Config any] interface {
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a comment to explain that 👍

Warashi and others added 2 commits February 4, 2025 10:30
…meter

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Co-authored-by: Tetsuya KIKUCHI <97105818+t-kikuc@users.noreply.github.com>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@Warashi Warashi requested a review from t-kikuc February 4, 2025 01:33
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
t-kikuc
t-kikuc previously approved these changes Feb 4, 2025
Copy link
Member

@t-kikuc t-kikuc left a comment

Choose a reason for hiding this comment

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

LGTM

Let's sophisticate the SDK through implementing plugins.

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@Warashi
Copy link
Member Author

Warashi commented Feb 6, 2025

I updated the copyright notice year to 2025 since these files were added this year.

@Warashi Warashi requested a review from t-kikuc February 6, 2025 22:22
Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

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

Thank you. LGTM

@Warashi Warashi merged commit 936879c into master Feb 13, 2025
12 of 14 checks passed
@Warashi Warashi deleted the plugin-sdk branch February 13, 2025 02:20
@github-actions github-actions bot mentioned this pull request Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants