Skip to content

[SDK] add unit types to use in config types#5959

Merged
Warashi merged 3 commits into
masterfrom
sdk-config-unit
Jun 23, 2025
Merged

[SDK] add unit types to use in config types#5959
Warashi merged 3 commits into
masterfrom
sdk-config-unit

Conversation

@Warashi
Copy link
Copy Markdown
Member

@Warashi Warashi commented Jun 19, 2025

What this PR does:

as title

Why we need it:

They are used generally in the platform provider's specific configs in pipedv0, and are useful to define config types.
And I want to use them in the Kubernetes plugin.

In the current implementation of the Kubernetes plugin, we use pkg/configv1, but it's not a good way.

import config "github.com/pipe-cd/pipecd/pkg/configv1"
// K8sBaselineRolloutStageOptions contains all configurable values for a K8S_BASELINE_ROLLOUT stage.
type K8sBaselineRolloutStageOptions struct {
// How many pods for BASELINE workloads.
// An integer value can be specified to indicate an absolute value of pod number.
// Or a string suffixed by "%" to indicate an percentage value compared to the pod number of PRIMARY.
// Default is 1 pod.
Replicas config.Replicas `json:"replicas"`

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):

Warashi added 3 commits June 19, 2025 16:41
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@Warashi Warashi requested a review from a team as a code owner June 19, 2025 07:59
@github-actions github-actions Bot added area/go area/plugin-sdk piped-plugin-sdk labels Jun 19, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 19, 2025

Codecov Report

Attention: Patch coverage is 91.48936% with 8 lines in your changes missing coverage. Please review.

Project coverage is 28.60%. Comparing base (f39124f) to head (d7dfc5f).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/plugin/sdk/unit/replicas.go 89.13% 4 Missing and 1 partial ⚠️
pkg/plugin/sdk/unit/duration.go 86.36% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5959      +/-   ##
==========================================
+ Coverage   28.50%   28.60%   +0.10%     
==========================================
  Files         520      523       +3     
  Lines       56434    56528      +94     
==========================================
+ Hits        16084    16170      +86     
- Misses      39083    39089       +6     
- Partials     1267     1269       +2     
Flag Coverage Δ
. 23.80% <ø> (ø)
.-pkg-app-pipedv1-plugin-example 0.00% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes 66.42% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes_multicluster 67.51% <ø> (ø)
.-pkg-app-pipedv1-plugin-wait 35.51% <ø> (ø)
.-pkg-plugin-sdk 50.97% <91.48%> (+2.11%) ⬆️
.-tool-actions-gh-release 19.23% <ø> (ø)
.-tool-actions-plan-preview 25.30% <ø> (ø)
.-tool-codegen-protoc-gen-auth 0.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@khanhtc1202
Copy link
Copy Markdown
Member

It's a bit hard to decide whether we should include this in the SDK or keep these plugins separate and accept the fact that they could be redundant and copied around.

I think what is placed in the SDK should be something more like piped care about, not something plugins need. Since we can say it's common, but it may block/confuse other plugins that don't want to use the SDK-defined config structure. WDYT?

@Warashi
Copy link
Copy Markdown
Member Author

Warashi commented Jun 19, 2025

Yes, I also think it's hard to decide whether we should put these in the SDK. I noticed we already have a " diff " package; it's not something piped cares about, but a package we thought was commonly used across plugins.
IMO, we can propose some best practices for plugin developers about the config structure and include the use of this unit package.

@khanhtc1202
Copy link
Copy Markdown
Member

@Warashi I got your point, then for now I only concern for the name of package, but it's not too strong. Let's keep it as is for now 👍

Copy link
Copy Markdown
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Copy Markdown
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.

thanks, wait stage needs it too.

@Warashi Warashi merged commit 8a12400 into master Jun 23, 2025
40 checks passed
@Warashi Warashi deleted the sdk-config-unit branch June 23, 2025 06:58
@github-actions github-actions Bot mentioned this pull request Jul 14, 2025
@github-actions github-actions Bot mentioned this pull request Aug 15, 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