mirror of
https://github.com/gotempsh/temps.git
synced 2026-04-25 06:15:55 +03:00
[PR #5] [MERGED] fix(deployments): add pre-flight image existence check before rollback #9
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/temps#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/gotempsh/temps/pull/5
Author: @dviejokfs
Created: 2/17/2026
Status: ✅ Merged
Merged: 2/17/2026
Merged by: @dviejokfs
Base:
main← Head:fix/rollback-preflight-image-check📝 Commits (1)
bd34152fix(deployments): add pre-flight image existence check before rollback📊 Changes
3 files changed (+140 additions, -0 deletions)
View changed files
📝
crates/temps-deployer/src/docker.rs(+13 -0)📝
crates/temps-deployer/src/lib.rs(+7 -0)📝
crates/temps-deployments/src/services/services.rs(+120 -0)📄 Description
Summary
rollback_to_deploymentbefore any container operations begin, preventing mid-rollback failures that could disrupt the currently running deploymentContainerDeployer::image_exists()trait method with a defaultOk(true)fallback for backward compatibility;DockerRuntimeoverrides it using Docker's inspect API (returnsfalseon 404)Problem
When rolling back to a previous deployment whose Docker image had been pruned or removed, the rollback would fail mid-way during
docker.create_container()with a confusing nested error. By that point, the current deployment's containers may have already been disrupted, leaving the environment in a broken state.Solution
The image existence check runs before any deployment work begins (before
DeployImageJobexecution). If the image is missing, rollback is aborted cleanly with no side effects.Changes
crates/temps-deployer/src/lib.rsimage_exists()toContainerDeployertrait with default implcrates/temps-deployer/src/docker.rsDockerRuntimeoverride usinginspect_imageAPI, 404 →falsecrates/temps-deployments/src/services/services.rsrollback_to_deployment, mock updates, new testTesting
test_rollback_fails_when_image_missing— verifies rollback returns clear error when image doesn't exist🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.