Skip to content

Add flightctl-api-version for imageBuilder API#466

Merged
celdrake merged 1 commit intoflightctl:mainfrom
celdrake:imagebuilder-api-version
Feb 3, 2026
Merged

Add flightctl-api-version for imageBuilder API#466
celdrake merged 1 commit intoflightctl:mainfrom
celdrake:imagebuilder-api-version

Conversation

@celdrake
Copy link
Collaborator

@celdrake celdrake commented Feb 3, 2026

Adapts the UI to send the expected header for ImageBuilder API (v1alpha1).

Requires flightctl/flightctl#2452

Summary by CodeRabbit

  • Refactor
    • Enhanced API versioning system to dynamically manage versions across multiple APIs (flightctl, imagebuilder, alerts).
    • Improved request header construction to use dynamic API versioning instead of static values.
    • Reorganized internal constants to better support multi-API architecture and improved system flexibility.

@celdrake celdrake requested a review from sk-ilya February 3, 2026 10:00
@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

Warning

Rate limit exceeded

@celdrake has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

This PR refactors API versioning from a single API_VERSION constant to multiple API-specific version constants (CORE_API_VERSION, IMAGEBUILDER_API_VERSION) and introduces a getApiVersion() helper function to dynamically determine versions based on API type.

Changes

Cohort / File(s) Summary
API Version Constants
libs/ui-components/src/constants.ts
Split API_VERSION into CORE_API_VERSION and IMAGEBUILDER_API_VERSION. Added getApiVersion(api) helper function returning version strings for 'flightctl' and 'imagebuilder', undefined for 'alerts'. Exported previously internal constants: APP_TITLE, PAGE_SIZE, EVENT_PAGE_SIZE, CERTIFICATE_VALIDITY_IN_YEARS.
API Call Utilities
apps/ocp-plugin/src/utils/apiCalls.ts, apps/standalone/src/app/utils/apiCalls.ts
Introduced Api type alias ('flightctl' | 'imagebuilder' | 'alerts'). Updated addRequiredHeaders to accept Api parameter and use getApiVersion(api) for dynamic version lookup. Modified HTTP helper invocations to pass Api value instead of static API_VERSION. Extended getFullApiUrl return type to include api key.
Resource Factory Utilities (Core API)
libs/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.ts, libs/ui-components/src/components/Fleet/CreateFleet/utils.ts, libs/ui-components/src/components/Repository/CreateRepository/utils.ts, libs/ui-components/src/utils/search.ts
Replaced API_VERSION imports with CORE_API_VERSION. Updated apiVersion field assignments in resource objects.
Resource Factory Utilities (ImageBuilder API)
libs/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/utils.ts
Replaced API_VERSION imports with IMAGEBUILDER_API_VERSION. Updated apiVersion fields in getImageBuildResource and getImageExportResource.
OpenAPI Schema Generation
libs/ui-components/scripts/openapi-typescript.js
Introduced dynamic API versioning in getSwaggerUrl: returns v1beta1 for CORE_API, v1alpha1 for IMAGEBUILDER_API. Updated config to consume full URL directly from getSwaggerUrl(api) without additional suffix concatenation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: adding flightctl-api-version header support for the imageBuilder API. However, it only addresses one aspect of a more comprehensive refactoring that also updates the core/flightctl API versioning and restructures the API versioning system.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

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

@celdrake celdrake force-pushed the imagebuilder-api-version branch from 25ba1a2 to 0cbfffb Compare February 3, 2026 10:10
@celdrake celdrake merged commit 5af0d19 into flightctl:main Feb 3, 2026
6 checks passed
@celdrake celdrake deleted the imagebuilder-api-version branch February 3, 2026 14:20
celdrake added a commit to celdrake/flightctl-ui that referenced this pull request Feb 3, 2026
celdrake added a commit that referenced this pull request Feb 3, 2026
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.

2 participants