HYPERFLEET-1024 - feat: CI for schema checks, version bump, externalize as Go module#42
HYPERFLEET-1024 - feat: CI for schema checks, version bump, externalize as Go module#42mliptak0 wants to merge 1 commit intoopenshift-hyperfleet:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughThis pull request releases v1.0.11 of the HyperFleet API specification with infrastructure and distribution improvements. The changes introduce automated GitHub Actions workflows for continuous integration (schema validation and linting via Spectral) and release automation (version extraction, tagging, and multi-artifact publishing). The build system is updated to use a locally installed TypeSpec compiler from Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 53-63: The version check currently does only string equality on
CURRENT and LATEST and doesn't guard empty values; update the CI step to first
fail if either CURRENT (from main.tsp) or LATEST is empty, then perform a
semver-aware comparison (e.g. using sort -V) to ensure CURRENT is strictly
greater than LATEST — reference the CURRENT and LATEST variables and replace the
equality check block with: 1) empty-value guard for CURRENT and LATEST, 2)
semver comparison that fails if the sorted highest version is not CURRENT, and
3) keep the existing messages but return non-zero on equal or downgraded
versions.
In @.github/workflows/release.yml:
- Around line 28-33: The "Extract version" step sets VERSION from main.tsp but
doesn't guard against an empty result, which yields a malformed tag "v"; update
the step to validate VERSION after extraction (the shell variable VERSION used
in the step) and if it's empty, print a clear error to stderr and exit with
non-zero status so the workflow fails instead of creating a "v" tag, or
alternatively conditionally set the "tag" output only when VERSION is non-empty;
ensure the outputs "version" and "tag" are only written to GITHUB_OUTPUT when
VERSION contains a value and include context (e.g., reference to main.tsp) in
the error message.
In `@CHANGELOG.md`:
- Line 21: The changelog entry incorrectly states "Node.js 24 runtime" while the
workflows still set node-version: '20'; update the CHANGELOG line that currently
reads "Bumped `actions/checkout` and `actions/setup-node` to v6 (Node.js 24
runtime)" to accurately reflect the runtime (e.g., remove the "(Node.js 24
runtime)" parenthetical or change it to "(Node.js 20 runtime)"), so the text
matches the actual `node-version: '20'` used in the workflows.
In `@go.mod`:
- Line 3: Update the Go version directive in go.mod from "go 1.25.0" to a lower,
compatible version such as "go 1.16" or "go 1.17" to broaden downstream
compatibility; open go.mod, locate the line containing the literal token "go
1.25.0" and replace it with "go 1.16" (or "go 1.17") since only //go:embed
(introduced in 1.16) is required by the module.
In `@README.md`:
- Around line 365-367: The fenced code block containing the Go module replace
directive (the line starting with "replace
github.com/openshift-hyperfleet/hyperfleet-api-spec =>
/path/to/local/hyperfleet-api-spec") should include a language specifier to
enable syntax highlighting and silence MD040; change the opening backticks from
"```" to "```go" so the block reads "```go" followed by the replace directive
and then the closing "```".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: d5cdb396-db24-4ad4-9c30-d1c9df7625b3
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (17)
.github/workflows/ci.yml.github/workflows/release.yml.spectral.yamlCHANGELOG.mdCLAUDE.mdCONTRIBUTING.mdREADME.mdRELEASING.mdbuild-schema.shgo.modmain.tspmodels/common/model.tspschemas/core/openapi.yamlschemas/core/swagger.yamlschemas/gcp/openapi.yamlschemas/gcp/swagger.yamlschemas/schemas.go
| - name: Check schema consistency | ||
| run: | | ||
| if ! git diff --exit-code schemas/; then | ||
| echo "Committed schemas are out of sync with TypeSpec sources." | ||
| echo "Run './build-schema.sh core --swagger && ./build-schema.sh gcp --swagger' and commit the results." | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
Should this run always regardless of finding schemas in the git diff?
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| run: npm ci | ||
|
|
||
| - name: Install Spectral CLI | ||
| run: npm install -g @stoplight/spectral-cli@6.15.1 |
There was a problem hiding this comment.
ci.yml:28 — global Spectral install contradicts tsp-to-local migration
This PR removes the global tsp install in favor of node_modules/.bin/tsp to eliminate version mismatches, but installs Spectral globally (npm install -g @stoplight/spectral-cli@6.15.1). Consider adding @stoplight/spectral-cli as a pinned devDependency and invoking via npx spectral or node_modules/.bin/spectral for consistency.
Summary
Added CI workflow (ci.yml) that runs on every PR and push to main: rebuilds all four schemas from TypeSpec, checks consistency against committed files, lints both openapi.yaml files with spectral:oas, and enforces a version bump against the latest release tag.
Replaced manual release process with automated release.yml that triggers on push to main, extracts version from main.tsp, auto-creates an annotated tag, and publishes a GitHub Release with all four artifacts attached (core-openapi.yaml, core-swagger.yaml, gcp-openapi.yaml, gcp-swagger.yaml).
Added go.mod and schemas/schemas.go exposing all generated schemas via //go:embed as embed.FS, enabling downstream Go consumers to import versioned schemas as a module dependency without vendoring local copies.
Added .spectral.yaml with spectral:oas ruleset. Fix Error.instance field format from uri to uri-reference per RFC 7807. Bump actions/checkout and actions/setup-node to v6.
Update CHANGELOG.md
Test Plan
make test-allpassesmake lintpassesmake test-helm(if applicable)Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores