Skip to content

pipecd: Add API client and settings page - #1300

Open
harshitghagre wants to merge 9 commits into
headlamp-k8s:mainfrom
harshitghagre:pipecd-settings-page
Open

harshitghagre wants to merge 9 commits into
headlamp-k8s:mainfrom
harshitghagre:pipecd-settings-page

Conversation

@harshitghagre

@harshitghagre harshitghagre commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds the API client and the Settings page for the PipeCD plugin.

The plugin talks to PipeCD's APIService over gRPC-Web using an API key. The client is generated from PipeCD's own .proto definitions. The Settings page lets users save their PipeCD server URL and API key, and test the connection before saving.

Depends on #1277

Part of the LFX Mentorship 2026 Term 3, tracked in pipe-cd/pipecd#6706.

Screenshot

image image

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution.

Could you take a look at the commit messages in this PR? We follow a Linux kernel style for git commits — see the contributing guide and git log for examples.

Commits that need attention
  • pipecd: add initial plugin project structure — Description must start with a capital letter — e.g. frontend: HomeButton: Fix the button not frontend: HomeButton: fix the button.
  • pipecd: trim README to a placeholder — Description must start with a capital letter — e.g. frontend: HomeButton: Fix the button not frontend: HomeButton: fix the button.
  • pipecd: add Apache license header — Description must start with a capital letter — e.g. frontend: HomeButton: Fix the button not frontend: HomeButton: fix the button.
  • pipecd: add API client and settings page — Description must start with a capital letter — e.g. frontend: HomeButton: Fix the button not frontend: HomeButton: fix the button.
Commit guidelines
  • Use atomic commits focused on a single change.
  • Use the title format <area>: <Description of changes> — description must start with a capital letter.
  • Keep the title under 72 characters (soft requirement).
  • Explain the intention and why the change is needed.
  • Make commit titles meaningful and describe what changed.
  • Do not add code that a later commit rewrites; squash or reorder commits instead.
  • Do not include Fixes #NN in commit messages.

Good examples:

  • frontend: HomeButton: Fix so it navigates to home
  • backend: config: Add enable-dynamic-clusters flag

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Insecure HTTP credential transmission, ineffective cancellation options, and response-mapping defects must be corrected.

Review effort: Balanced
Findings: 1 High severity · 5 Medium severity · 1 Low severity

Open (7)
What changed in this PR

Adds PipeCD gRPC-Web connectivity and a settings page as the foundation for displaying PipeCD applications and deployments in Headlamp.

Changes:

  • Adds API-key configuration, connection testing, and sidebar routing.
  • Adds typed application/deployment API wrappers and tests.
  • Vendors generated PipeCD protobuf models and service definitions.
File Description
pipecd/​.gitignore Defines ignored artifacts.
pipecd/​.prettierignore Excludes generated sources.
pipecd/​AGENTS.md Adds contributor guidance.
pipecd/​README.md Adds plugin heading.
pipecd/​logo.png Adds plugin logo.
pipecd/​package-lock.json Locks dependencies.
pipecd/​package.json Defines plugin metadata and tooling.
pipecd/​tsconfig.json Configures TypeScript.
pipecd/​locales/​en/​translation.json Initializes translations.
pipecd/​src/​__tests__/​SettingsPage.test.tsx Tests settings behavior.
pipecd/​src/​__tests__/​pipecd-api.test.ts Tests API wrappers and mappings.
pipecd/​src/​api/​pipecd.ts Implements configuration and API client.
pipecd/​src/​components/​SettingsPage.tsx Implements settings UI.
pipecd/​src/​generated/​pkg/​app/​server/​service/​apiservice/​service_pb.ts Generates API service definitions.
pipecd/​src/​generated/​pkg/​app/​server/​service/​webservice/​service_pb.ts Generates web service definitions.
pipecd/​src/​generated/​pkg/​model/​analysis_result_pb.ts Generates analysis models.
pipecd/​src/​generated/​pkg/​model/​apikey_pb.ts Generates API-key models.
pipecd/​src/​generated/​pkg/​model/​application_live_state_pb.ts Generates live-state models.
pipecd/​src/​generated/​pkg/​model/​application_pb.ts Generates application models.
pipecd/​src/​generated/​pkg/​model/​command_pb.ts Generates command models.
pipecd/​src/​generated/​pkg/​model/​common_pb.ts Generates shared models.
pipecd/​src/​generated/​pkg/​model/​deployment_chain_pb.ts Generates deployment-chain models.
pipecd/​src/​generated/​pkg/​model/​deployment_pb.ts Generates deployment models.
pipecd/​src/​generated/​pkg/​model/​deployment_trace_pb.ts Generates trace models.
pipecd/​src/​generated/​pkg/​model/​event_pb.ts Generates event models.
pipecd/​src/​generated/​pkg/​model/​insight_pb.ts Generates insight models.
pipecd/​src/​generated/​pkg/​model/​logblock_pb.ts Generates log models.
pipecd/​src/​generated/​pkg/​model/​notificationevent_pb.ts Generates notification models.
pipecd/​src/​generated/​pkg/​model/​piped_pb.ts Generates Piped models.
pipecd/​src/​generated/​pkg/​model/​piped_stat_pb.ts Generates Piped statistics.
pipecd/​src/​generated/​pkg/​model/​planpreview_pb.ts Generates plan-preview models.
pipecd/​src/​generated/​pkg/​model/​project_pb.ts Generates project models.
pipecd/​src/​generated/​pkg/​model/​rbac_pb.ts Generates RBAC models.
pipecd/​src/​generated/​pkg/​model/​role_pb.ts Generates role models.
pipecd/​src/​generated/​pkg/​model/​user_pb.ts Generates user models.
pipecd/​src/​generated/​validate/​validate_pb.ts Generates validation descriptors.
pipecd/​src/​headlamp-plugin.d.ts Declares plugin asset modules.
pipecd/​src/​images.d.ts Adds duplicate PNG declaration.
pipecd/​src/​index.tsx Registers navigation and route.
pipecd/​src/​types/​pipecd.ts Defines client-facing domain types.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pipecd/src/components/SettingsPage.tsx Outdated
Comment thread pipecd/src/api/pipecd.ts
Comment thread pipecd/src/api/pipecd.ts Outdated
Comment thread pipecd/src/api/pipecd.ts Outdated
Comment thread pipecd/src/api/pipecd.ts Outdated
Comment thread pipecd/src/components/SettingsPage.tsx Outdated
Comment thread pipecd/README.md Outdated
@harshitghagre

Copy link
Copy Markdown
Contributor Author

@illume fixed

@harshitghagre harshitghagre changed the title pipecd: add API client and settings page pipecd: Add API client and settings page Sep 30, 2026
@harshitghagre
harshitghagre requested a lite review from Copilot October 7, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread pipecd/src/api/pipecd.ts Outdated
Comment thread pipecd/src/api/pipecd.ts Outdated
Comment thread pipecd/src/components/SettingsPage.tsx
Comment thread pipecd/README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Plugin-architecture deployments are misclassified as Kubernetes, and the unconfigured-state settings link does not use Headlamp routing.

1 open finding
4 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use a routed link that preserves the Headlamp base and cluster path

pipecd/​src/​components/​NotConfigured.tsx:16

This hash URL only changes the current page fragment; it does not navigate through Headlamp's registered route or preserve Headlamp's base/cluster path. Build the URL from the PipeCDSettings route and use a React Router link, as other internal Headlamp links do.

🧠 Review effort: Balanced

Comment thread pipecd/src/api/pipecd.ts Outdated
@illume illume added enhancement New feature or request pipecd labels Oct 11, 2026
@illume
illume requested a balanced review from Copilot October 11, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Unknown plugin kinds can be misclassified as Kubernetes, and navigation and localization issues remain.

0 open findings

1 resolved since last review
Previously missed (6)

In code that hasn't changed since last review

Medium severity Unrecognized deploy plugins incorrectly fall back to Kubernetes

pipecd/​src/​api/​pipecd.ts:177

When deployTargetsByPlugin contains only an unrecognized or future plugin, this falls back to the deprecated enum. Plugin-architecture pipeds leave that enum at zero, so the resource is incorrectly reported as Kubernetes instead of UNKNOWN. Only consult kind when there are no deploy-target keys.

Low severity Use established plugin API import path for useTranslation

pipecd/​AGENTS.md:125

The documented import path differs from the established official-plugin API: Flux, Karpenter, and cert-manager import useTranslation from @kinvolk/headlamp-plugin/lib (for example, flux/src/sources/SourceList.tsx:1). Keeping the wrong path here will direct future changes away from the repository convention.

Low severity Add coverage for stage-log response mapping

pipecd/​src/​api/​pipecd.ts:401

The stage-log wrapper is the only distinct response mapper in this API client without coverage; the test client does not even define listStageLogs. Add a test that verifies the deployment ID, bigint index/timestamp conversion, severity mapping, and completed propagation so this public API cannot regress unnoticed.

Low severity Translate empty state text and add English locale entries

pipecd/​src/​components/​NotConfigured.tsx:13

This new user-facing empty state also bypasses the plugin's enabled i18n bundle. Wrap the component's headings, descriptions, and button text with useTranslation from @kinvolk/headlamp-plugin/lib and add the extracted English entries, following cert-manager/src/components/orders/List.tsx:1-14.

This issue also appears on line 16 of the same file.

Low severity Translate hard-coded component copy using the plugin i18n bundle

pipecd/​src/​components/​SettingsPage.tsx:99

This component hard-codes its user-facing copy even though the plugin enables English i18n and ships a locale bundle. Official plugin UI components use useTranslation from @kinvolk/headlamp-plugin/lib (for example, flux/src/sources/SourceList.tsx:1-20); translate this component's labels, helpers, buttons, and result messages and extract the English resources.

Low severity Translate hard-coded placeholder text

pipecd/​src/​index.tsx:23

The placeholder's visible text is hard-coded while this plugin declares an i18n locale. Translate this copy with useTranslation from @kinvolk/headlamp-plugin/lib and extract it into the English locale, consistent with karpenter/src/Scaling/List.tsx:1-15.

🧠 Review effort: Balanced

@illume
illume requested a balanced review from Copilot October 12, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The central settings-save flow lacks component coverage, and the contributor guidance documents an inconsistent translation import.

1 open finding
Previously missed (1)

In code that hasn't changed since last review

Low severity Document the established useTranslation import path

pipecd/​AGENTS.md:125

This guidance conflicts with the plugin itself and the repository-wide import pattern: UI components import useTranslation from @kinvolk/headlamp-plugin/lib (for example, karpenter/src/Scaling/List.tsx:1, flux/src/sources/SourceList.tsx:1, and cert-manager/src/components/orders/List.tsx:1). Document the established path so future generated changes do not introduce an inconsistent or unavailable import.

🧠 Review effort: Balanced

Comment thread pipecd/src/components/SettingsPage.tsx
@harshitghagre
harshitghagre requested a balanced review from Copilot October 13, 2026 04:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey hey. The other PR is merged now, can you please rebase?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Application filtering and deployment-state mapping can return misleading data.

0 open findings

Previously missed (2)

In code that hasn't changed since last review

Medium severity Preserve deploying flag in effective application status

pipecd/​src/​api/​pipecd.ts:228

PipeCD reports active deployments through a.deploying, independently of the drift-derived syncState; its own status component gives that flag precedence. This mapper drops the flag, so deploying: true with a previous SYNCED state is returned as synced, and an absent syncState hides deployment activity entirely. Map the flag to the effective DEPLOYING status and add regression tests for both cases.

Medium severity Filter applications by resolved platform with pagination

pipecd/​src/​api/​pipecd.ts:325

The server's ListApplications handler filters the stored, deprecated Kind field, while resolveKind() uses deployTargetsByPlugin for v1 applications. A v1 Terraform application with the default Kind is therefore excluded by the Terraform filter and included by the Kubernetes filter. Apply filtering to resolved platforms rather than forwarding this legacy filter, and handle server pagination so matching applications are not skipped. Add regression tests for both filters.

🧠 Review effort: Balanced

Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Browser-side credential handling and cross-origin gRPC-Web integration need human validation, and the accessibility issue remains unresolved.

1 open finding

🧠 Review effort: Balanced

Comment thread pipecd/src/components/SettingsPage.tsx Outdated

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this.

Would you mind addressing the open Copilot review comments? Please mark each comment as resolved after addressing it.

Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
@harshitghagre

Copy link
Copy Markdown
Contributor Author

@illume PATL

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

URL validation, credential removal, and connection-test request limits need correction before approval.

1 open finding
1 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Test Connection fetches all applications when limit is zero

pipecd/​src/​components/​SettingsPage.tsx:109

listApplications(config) sends limit: 0. PipeCD passes that limit through to its datastore, and the Firestore adapter applies no limit when it is zero. Test Connection can therefore download and map every enabled application in the project just to validate credentials. Pass a small explicit pageSize, such as 1, and update the assertion in SettingsPage.test.tsx that currently requires undefined options.

Medium severity Users cannot clear saved API credentials

pipecd/​src/​components/​SettingsPage.tsx:192

After saving a connection, clearing the API key or both fields disables Save Settings. The old key remains in localStorage and reappears when the page is reopened, with no reset action available. Allow saving cleared fields while keeping Test Connection disabled for incomplete configurations, or provide an explicit action to remove the stored credentials.

🧠 Review effort: Balanced

Comment thread pipecd/src/components/SettingsPage.tsx
Signed-off-by: harshitghagre <harshitghagre183@gmail.com>
@harshitghagre
harshitghagre requested a review from illume October 17, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pipecd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants