[SDK] Allow users to set nothing config for the plugin in the app.pipecd.yaml#5937
Merged
t-kikuc merged 4 commits intoJun 11, 2025
Merged
Conversation
Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5937 +/- ##
==========================================
+ Coverage 28.47% 28.51% +0.03%
==========================================
Files 520 517 -3
Lines 56416 55929 -487
==========================================
- Hits 16066 15946 -120
+ Misses 39083 38724 -359
+ Partials 1267 1259 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Warashi
reviewed
Jun 11, 2025
| // Set the Spec to the zero value of the spec type to avoid nil pointer dereference. | ||
| c.Spec = new(Spec) | ||
| return nil | ||
| // It is necessary to prepare config with default value when users doesn't set any config. |
Member
There was a problem hiding this comment.
It's not only default config but also custom unmarshalling logic.
The point is to call json.Unmarshal to invoke custom unmarshalling logic.
Member
Author
|
|
||
| // Validate the spec if it implements the Validate method. | ||
| if v, ok := any(spec).(interface{ Validate() error }); ok { | ||
| if v, ok := any(&spec).(interface{ Validate() error }); ok { |
Member
There was a problem hiding this comment.
Is this the same as just below?
parsePluginConfig checks both Spec and *Spec are implement Validate() error.
Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
t-kikuc
reviewed
Jun 11, 2025
| // Set the Spec to the zero value of the spec type to avoid nil pointer dereference. | ||
| c.Spec = new(Spec) | ||
| return nil | ||
| // It is necessary to prepare config with default value when users doesn't set any config, or when developers implements custom unmarshalling logic. |
Member
There was a problem hiding this comment.
[nit] to clarify
Suggested change
| // It is necessary to prepare config with default value when users doesn't set any config, or when developers implements custom unmarshalling logic. | |
| // It is necessary to prepare config with default value when users don't set any config, or when plugin developers implement custom unmarshalling logic. |
Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
as ttile
Why we need it:
There is a case when users deploy without any plugin config in app.pipecd.yaml.
Which issue(s) this PR fixes:
Follow #5922
Does this PR introduce a user-facing change?: