Skip to content

Add plugin init scaffold to pipectl#6883

Open
kubeboiii wants to merge 1 commit into
pipe-cd:masterfrom
kubeboiii:feat/pipectl-plugin-init
Open

Add plugin init scaffold to pipectl#6883
kubeboiii wants to merge 1 commit into
pipe-cd:masterfrom
kubeboiii:feat/pipectl-plugin-init

Conversation

@kubeboiii
Copy link
Copy Markdown

What this PR does:

Adds pipectl plugin init and the pluginscaffold package to generate compile-ready Piped v1 plugin skeletons from embedded templates:

  • Stage-only layout (based on the wait plugin)
  • Deployment-minimal layout (based on a slim ecs-style layout)

The command supports --kind, --stages, --module, --name, --dry-run, and --force. Tests include golden output, name validation, and integration checks that run go mod tidy and go build for both kinds.

Why we need it:

Plugin authors currently copy and rename files from existing plugins (wait, ecs), which is slow and easy to get wrong. This addresses the MVP in #6694 and part of the scaffold epic in #6693.

Which issue(s) this PR fixes:

Fixes #6694

Related to #6693 (does not implement the full epic; see scope below).

Does this PR introduce a user-facing change?:

  • How are users affected by this change: Plugin authors can run pipectl plugin init to create a new plugin directory with a valid layout and stub implementations. Documentation is added under Contributing plugins and Command-line tool.
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Scope

In scope Out of scope (follow-up)
pipectl plugin init pipectl plugin add-stage (#6705)
Stage + deployment-minimal templates --livestate, --planpreview, --initialize (#6693)
Community module path default In-tree pkg/app/pipedv1/plugin/... helper

This change is additive: piped runtime and existing plugins are not modified. pipectl plugin push is unchanged.

The diff is larger than the ~300-line guideline in CONTRIBUTING because of embedded templates and golden testdata; it is limited to one feature (the init scaffold).


Test plan

  • make check
  • go test -race ./pkg/app/pipectl/pluginscaffold/... ./pkg/app/pipectl/cmd/plugin/...
make build/go MOD=pipectl

./.artifacts/pipectl plugin init /tmp/demo-stage \
  --kind stage --stages DEMO_WAIT
(cd /tmp/demo-stage && go mod tidy && go build .)

./.artifacts/pipectl plugin init /tmp/demo-deployment \
  --kind deployment --stages DEMO_SYNC,DEMO_ROLLBACK
(cd /tmp/demo-deployment && go mod tidy && go build .)

./.artifacts/pipectl plugin init /tmp/demo-dry-run \
  --kind stage --stages DEMO_WAIT --dry-run

Add pipectl plugin init and the pluginscaffold package to generate
compile-ready stage-only and deployment-minimal plugin skeletons.
Includes golden tests, integration build tests, and documentation.

Fixes pipe-cd#6694

Signed-off-by: Himanshu <himanshuwankhadeh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant