Skip to content

feat(rest-api): add campaign REST API over Flow operation runs#3718

Draft
kunzhao-nv wants to merge 6 commits into
NVIDIA:mainfrom
kunzhao-nv:feat/rest-campaign-api
Draft

feat(rest-api): add campaign REST API over Flow operation runs#3718
kunzhao-nv wants to merge 6 commits into
NVIDIA:mainfrom
kunzhao-nv:feat/rest-campaign-api

Conversation

@kunzhao-nv

@kunzhao-nv kunzhao-nv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

Add a campaign REST API over Flow's operation run — a phased, policy-gated rollout of one operation (firmware today) across many racks — so operators can drive and observe large multi-rack firmware rollouts instead of hand-scripting per-rack tasks.

  • Endpoints under /v2/org/{org}/nico/campaign: create, get, list, list per-rack targets, and the pause / resume / advance / cancel lifecycle actions. Each campaign materializes one execution target per rack; targets reference their taskId so callers drill into per-rack detail via the existing Task endpoints.
  • Create takes the full configuration tree: rack selector, execution options (max concurrency, safety gates, conflict-retry, ordering, phase policy), and the firmware operation.
  • Handlers authenticate, resolve the Flow-enabled site, and drive Temporal workflows → ManageCampaign activities → Flow's OperationRun gRPC, mirroring the existing task / rule plumbing.
  • Syncs the shared Flow proto so flowv1 exposes the OperationRun RPCs (including AdvanceOperationRunPhase), adds the OpenAPI spec, and regenerates docs + SDK.

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

Regenerate the shared Flow proto and Go stubs from flow/proto/v1/flow.proto
so the REST layer's flowv1 client exposes the OperationRun RPCs, including
AdvanceOperationRunPhase.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Wrap Flow's eight OperationRun RPCs in ManageCampaign activities and the
matching workflows (create, get, list, list-targets, pause, resume,
advance-phase, cancel), and register them with the site-agent Temporal worker.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Expose Flow operation runs as campaigns: create, get, list, list targets, and
the pause/resume/advance/cancel lifecycle actions. Handlers authenticate,
resolve the Flow-enabled site, and drive the campaign Temporal workflows,
converting OperationRun protos to API models.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Document the campaign endpoints and schemas: create, get, list, list targets,
and the pause/resume/advance/cancel lifecycle actions, including the nested
create configuration tree (selector, options, phase/safety/conflict/ordering
policies, and the firmware operation).

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Covers 52aeb04. Restores the io.Reader/[]byte decode branches the generator
version dropped so client.go carries only the CampaignAPI wiring.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Cover the campaign layer end to end: model validation, the create
configuration-tree ToProto, and proto-to-API conversions; the eight
ManageCampaign activities and their workflows; and the eight REST handlers
(auth, site/Flow gating, workflow invocation, response shape). Extends the
Flow gRPC mock with the OperationRun RPCs the activity tests exercise.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
@kunzhao-nv
kunzhao-nv requested a review from a team as a code owner July 20, 2026 15:45
@kunzhao-nv
kunzhao-nv marked this pull request as draft July 20, 2026 15:45
@copy-pr-bot

copy-pr-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bdeb93cb-bafc-497e-9783-495a4d7c6fea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@kunzhao-nv
kunzhao-nv requested a review from jw-nvidia July 20, 2026 15:47
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-07-20 15:48:55 UTC | Commit: ddd1cbd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant