Skip to content

feat(ci): sync generated API client from volcano-hosting#22

Closed
swkeever wants to merge 1 commit into
mainfrom
skeever/client-sync-workflow
Closed

feat(ci): sync generated API client from volcano-hosting#22
swkeever wants to merge 1 commit into
mainfrom
skeever/client-sync-workflow

Conversation

@swkeever

Copy link
Copy Markdown
Collaborator

What

Keep internal/apiclient in sync with volcano-hosting's public OpenAPI contract automatically. A scheduled client-sync workflow regenerates the client and opens a PR here when the upstream spec drifts.

How

  • Checks Kong/volcano-hosting out read-only (Kong App read token) and runs its make volcano-cli-apiclient-generate, so the exact oapi-codegen command lives once, upstream, shared with hosting's openapi-check gate — the client can't drift from the contract.
  • Opens/updates an auto/openapi-client PR with this repo's own GITHUB_TOKEN. No write access to a shared GitHub App is required.
  • GITHUB_TOKEN-opened PRs don't trigger pull_request CI, so the job builds + tests the regenerated client itself; the PR body and a failing job surface the result.
  • Triggers: daily cron + manual workflow_dispatch.

Prerequisites

  1. Depends on Kong/volcano-hosting#472 — that PR adds the shared generator (scripts/ci/gen-volcano-cli-apiclient.sh) and the volcano-cli-apiclient-generate make target this workflow calls. Merge it first.
  2. This repo needs vars.KONG_GH_APP_ID + secrets.KONG_GH_APP_PRIVATE_KEY available, and the Kong App must have contents: read on volcano-hosting. No write permissions anywhere.

Notes

The checked-in client predates volcano-hosting's recent logs API work, so the first run opens a real catch-up PR. Verified locally: regenerating with the upstream generator produces a client that builds against the internal/api wrapper and passes go test ./internal/apiclient/....

Add a client-sync workflow that regenerates internal/apiclient from
volcano-hosting's public OpenAPI spec and opens a PR when it drifts.

It checks volcano-hosting out read-only (Kong App read token) and runs that
repo's `make volcano-cli-apiclient-generate`, reusing the shared oapi-codegen
command so the client never drifts from the upstream contract. The PR is opened
with this repo's own GITHUB_TOKEN, so no shared GitHub App write access is
needed. Since GITHUB_TOKEN PRs don't trigger pull_request CI, the job builds and
tests the regenerated client itself before opening the PR.

Runs daily and on demand (workflow_dispatch).
go test ./internal/apiclient/...

- name: Create or update PR
uses: peter-evans/create-pull-request@v7
@swkeever swkeever closed this Jun 28, 2026
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.

2 participants