Docs V1: Add plugin tutorial Chapter 5 - Building sync stages - #7154
Docs V1: Add plugin tutorial Chapter 5 - Building sync stages#7154rahulshendre wants to merge 3 commits into
Conversation
Signed-off-by: rahulshendre <rahulshendre789@gmail.com>
|
@mohammedfirdouss @armistcxy could you help me check this docs 👀 |
| return nil, fmt.Errorf("no stages defined in the request") | ||
| } | ||
|
|
||
| stages := make([]sdk.PipelineStage, 0, len(input.Request.Stages)+1) |
There was a problem hiding this comment.
add comment to explain why +1
Suggest: "+1 leaves room for the rollback stage without a second allocation" and remove L60
| } | ||
| } | ||
|
|
||
| if input.Request.Rollback { |
There was a problem hiding this comment.
We can also add comment to explain this part
Suggest: Rollback restores our changes before any of our later stages run so it shares the smallest index among the requested stages
There was a problem hiding this comment.
Added a comment here, though I tweaked the wording slightly... digging into planner.go, piped appends all rollback stages after the normal ones and only uses this index to order them across plugins, so I framed it that way rather than "before our later stages", also reworded the bullet above to match.
Good catch, this spot is what made me re-check the planner, thanks @armistcxy : )
armistcxy
left a comment
There was a problem hiding this comment.
Hi @rahulshendre , everything looks good overall
There are a few places where I think we could make things better. Perhaps you could consider them
✅ Deploy Preview for pipecd-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7154 +/- ##
==========================================
+ Coverage 29.74% 36.03% +6.28%
==========================================
Files 601 100 -501
Lines 64408 8548 -55860
==========================================
- Hits 19158 3080 -16078
+ Misses 43758 5298 -38460
+ Partials 1492 170 -1322
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds Chapter 5 to the Docs V1 “creating a plugin” tutorial, focusing on how a plugin plans stages for pipeline sync vs quick sync in PipeCD’s plugin SDK.
Changes:
- Introduces a new tutorial chapter explaining
BuildPipelineSyncStagesandBuildQuickSyncStages. - Provides example implementations (including rollback handling) and notes on required imports.
- Adds build verification guidance (
go build ./...) for the tutorial’s code.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: rahulshendre <rahulshendre789@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
docs/content/en/docs-v1.0.x/plugins/creating-a-plugin/chapter-05-building-sync-stages.md:13
- This sentence implies
pipedpasses the entire application pipeline to the plugin, but the planner groups stages by stage name and calls each plugin with only the stage configs that belong to that plugin (indexes remain the original pipeline positions). Clarifying this avoids confusion when users have multi-plugin pipelines.
`piped` calls `BuildPipelineSyncStages` for a pipeline sync deployment. It passes the stages the user defined in the application's pipeline, and the plugin returns the stage list `piped` runs.
docs/content/en/docs-v1.0.x/plugins/creating-a-plugin/chapter-05-building-sync-stages.md:104
- Same issue here:
sdk.ConfigNoneis already a pointer alias, so this should not be*sdk.ConfigNone(otherwise the example becomes**struct{}and won’t compile).
func (p *plugin) BuildQuickSyncStages(ctx context.Context, _ *sdk.ConfigNone, input *sdk.BuildQuickSyncStagesInput) (*sdk.BuildQuickSyncStagesResponse, error) {
| Replace the empty method with the following: | ||
|
|
||
| ```go | ||
| func (p *plugin) BuildPipelineSyncStages(ctx context.Context, _ *sdk.ConfigNone, input *sdk.BuildPipelineSyncStagesInput) (*sdk.BuildPipelineSyncStagesResponse, error) { |
There was a problem hiding this comment.
@rahulshendre no worry, this is false alert :)))
There was a problem hiding this comment.
Proof that still can compile: https://go.dev/play/p/JiU8j0GveNl
What this PR does:
Adds chapter 5 of the creating a plugin tutorial, majorly covers how to implement the BuildPipelineSyncStages and BuildQuickSyncStages
Why we need it:
5th chapter of the tutorial
Which issue(s) this PR fixes:
Part of #6679
Does this PR introduce a user-facing change?: