Skip to content

Image validation#529

Open
psanghvi17 wants to merge 3 commits intomainfrom
image-validation
Open

Image validation#529
psanghvi17 wants to merge 3 commits intomainfrom
image-validation

Conversation

@psanghvi17
Copy link
Contributor

@psanghvi17 psanghvi17 commented Feb 19, 2026

PR Checklist

  • Linting Test is passing
  • Code is well documented
  • If applicable, a PR in the epinio/docs repository has been opened

Summary

Fixes #
Adds validation for the Paketo Builder Image field in the application source form: the UI calls the Epinio API to validate the builder image before staging. Shows real-time feedback (valid / invalid / validating) and handles auth failures and stale responses.

Occurred changes and/or fixed issues

Custom input for “Paketo Builder Image” with 500ms debounced calls to GET /api/v1/validate-builder-image?image=.
Validation states: “Validating…”, valid (green), invalid (red with message/suggestion), and auth error (“Could not validate. Sign in again.”).

Technical notes summary

The Epinio backend exposes GET /api/v1/validate-builder-image?image= (format + optional registry check). The UI does not call the new buildpack search/verify APIs; those are for future buildpack selection/validation.
Store returns the API response on the body (with _status), not as { data, status }. The handler uses body._status, body.valid, body.message, body.suggestion and always clears the validating state on completion.
Debounce (500ms) limits API calls while the user types. Only the latest request’s result is applied; older responses are ignored when (builderImage.value || '').trim() !== image.

Areas or cases that should be tested

Happy path:
Open Create/Edit Application → Source (e.g. buildpacks, custom builder).
In “Paketo Builder Image”, enter a valid image (e.g. paketobuildpacks/builder:full).
After ~500ms, “Validating…” appears, then a valid state (e.g. green check).

Invalid image:
Enter an invalid or non-existent image (e.g. invalid/bogus:latest).
After validation, invalid state and message/suggestion are shown.

Areas which could experience regressions

Screenshot/Video

Add client-side, debounced API validation for the builder image in AppSource.vue. Introduces validation state (idle/validating/valid/invalid), error and suggestion fields, a 500ms debounce timer, and functions to schedule, clear and call the /api/v1/validate-builder-image endpoint via store.dispatch. Integrates validation into form rules (builderImageRule), prevents submission when invalid, and updates UI: aria attributes, validation status messages, and styling. Also add localized strings for validating/valid/validation errors in en-us.yaml. This improves UX by providing live feedback and suggestions for invalid builder images and handling network errors.
Adjust builder image validation to handle the store.request response shape (body with _status) and avoid race conditions by ignoring out-of-date responses. Set validation status to 'idle' for non-200 responses, clear the validating state once a response arrives, and map 401/403 errors to a distinct auth error message. Add a new i18n key (validationAuthError) for the authentication-specific error text.
Prefer structured API error details when validating builder images by extracting errors[0].title or errors[0].details and falling back to data.message. Renamed local variable and updated both auth and network error branches to use this API-derived message (with existing i18n fallbacks). This yields clearer validation errors from the API response.
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