feat(services): fast env apply after save — restart without rebuild - #681
Open
Rish-it wants to merge 4 commits into
Open
feat(services): fast env apply after save — restart without rebuild#681Rish-it wants to merge 4 commits into
Rish-it wants to merge 4 commits into
Conversation
Pure helper returning the deployApi.trigger payload for a refresh-only
redeployment of one service ({ projectId, refresh: true, serviceIds }).
Contract pinned by unit tests; mirrors the refresh path the API already
honors for project-level fast env apply.
After saving environment variables on a service with a live deployment, swap the Save button for Apply, which triggers a refresh deployment that recreates only that service from its existing image — no rebuild. Mirrors the project-level EnvVarsEditor flow; response handling and build-page navigation follow the panel's existing redeploy handler. Pending offer resets on service switch so it can't leak across services. Fixes oblien#669
The refresh path (POST /deployments with refresh+serviceIds) had zero coverage despite being the engine behind the fast env apply. Pins: - per-service refresh lands as an exclusive non-force subset (meta.targetServiceIds + meta.refreshServiceIds) - disabled services are filtered out of an explicit scope - no active deployment / empty enabled target fail loudly instead of silently re-cloning - refresh skips the git HEAD lookup and inherits the active commit
- key the apply offer by service id, not a boolean reset by an env-identity effect — refetches replace service objects wholesale, so the old offer could never survive to render - drop the trigger-payload helper and its test; inline the call like handleRedeployService already does - guard Apply on enabled services; disabled ones surfaced the backend's raw "Nothing to refresh" error - keep the spinner set through navigation instead of resetting it in a finally (button flickered back to Save mid-route-change) - own i18n keys under projectDetail.services.detail in all locales; borrowed projectSettings copy didn't name the service - remove stray blank line in build.service.test.ts Backend refresh-contract tests unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #669
Summary
Services panel now offers a fast Apply after saving environment variables on a service with a live deployment. Apply triggers a refresh deployment that recreates only that service from its existing image — no rebuild, same as the project-level fast apply.
Changes (2 atomic commits)
feat(dashboard): add per-service env apply trigger payload helper— pure helper (service-env-apply.ts) returning{ projectId, refresh: true, serviceIds: [serviceId] }, the contract the API's refresh path already honors. Unit tests pin the payload shape and that it never pulls source.feat(services): offer restart-only env apply after env save—ServiceDetailPanelswaps Save → Apply once env is saved and a deployment is live. Clicking routes to/build/<id>for progress, matching the panel's existing redeploy handler (same response guard, same navigation). Pending offer resets on service switch so it can't leak across services. Editing again reverts to Save.Reuses existing pieces only: backend
refresh + serviceIdspath, panel'sdeployApiimport andRotateCwicon, i18n keys fromprojectSettings.json(envVars.applyButton,envVars.toast.applyFailed*). No new dependencies, no new translation entries.Testing
service-env-apply.test.tstsc --noEmit: clean