fix: use imageID in createAndStartContainer (closes #124) #127

Merged
sneak merged 1 commits from fix/use-image-id-in-container into main 2026-02-23 20:48:23 +01:00
Collaborator

Wire the imageID parameter (returned from docker build) through createAndStartContainer and buildContainerOptions instead of reconstructing a mutable tag via fmt.Sprintf.

This ensures containers reference the immutable image digest, avoiding tag-reuse races when deploys overlap.

Changes

  • Rename _ string to imageID string in createAndStartContainer
  • Change buildContainerOptions to accept imageID string instead of deploymentID int64
  • Use imageID directly as the Image field in container options
  • Update rollback path to pass previousImageID directly (removing redundant override)
  • Add test verifying imageID flows through to container options
  • Add database.NewTestDatabase and logger.NewForTest test helpers

make check

==> All checks passed!
Wire the `imageID` parameter (returned from docker build) through `createAndStartContainer` and `buildContainerOptions` instead of reconstructing a mutable tag via `fmt.Sprintf`. This ensures containers reference the immutable image digest, avoiding tag-reuse races when deploys overlap. ## Changes - Rename `_ string` to `imageID string` in `createAndStartContainer` - Change `buildContainerOptions` to accept `imageID string` instead of `deploymentID int64` - Use `imageID` directly as the `Image` field in container options - Update rollback path to pass `previousImageID` directly (removing redundant override) - Add test verifying imageID flows through to container options - Add `database.NewTestDatabase` and `logger.NewForTest` test helpers ## make check ``` ==> All checks passed! ```
sneak was assigned by clawbot 2026-02-21 11:25:01 +01:00
clawbot added 1 commit 2026-02-21 11:25:01 +01:00
fix: use imageID in createAndStartContainer (closes #124)
All checks were successful
Check / check (pull_request) Successful in 11m24s
0e8efe1043
Wire the imageID parameter (returned from docker build) through
createAndStartContainer and buildContainerOptions instead of
reconstructing a mutable tag via fmt.Sprintf.

This ensures containers reference the immutable image digest,
avoiding tag-reuse races when deploys overlap.

Changes:
- Rename _ string to imageID string in createAndStartContainer
- Change buildContainerOptions to accept imageID string instead of deploymentID int64
- Use imageID directly as the Image field in container options
- Update rollback path to pass previousImageID directly
- Add test verifying imageID flows through to container options
- Add database.NewTestDatabase and logger.NewForTest test helpers
clawbot added the
merge-ready
label 2026-02-21 12:45:12 +01:00
Author
Collaborator

Code Review: LGTM

Summary: Fixes buildContainerOptions to use the actual Docker image ID instead of constructing a tag from deploymentID. Also fixes rollback to pass imageID correctly.

Changes reviewed:

  • buildContainerOptions now accepts imageID string instead of deploymentID int64 — correct
  • createAndStartContainer passes imageID through properly — correct
  • Rollback path now passes previousImageID directly to buildContainerOptions instead of overwriting opts.Image after the fact — cleaner
  • New test (TestBuildContainerOptionsUsesImageID) validates the fix
  • Test helpers (database/testing.go, logger/testing.go, export_test.go) are clean

make check: PASS — all tests pass, build succeeds.

Labeled merge-ready, assigned to @sneak.

## Code Review: ✅ LGTM **Summary:** Fixes `buildContainerOptions` to use the actual Docker image ID instead of constructing a tag from `deploymentID`. Also fixes rollback to pass `imageID` correctly. **Changes reviewed:** - `buildContainerOptions` now accepts `imageID string` instead of `deploymentID int64` — correct - `createAndStartContainer` passes `imageID` through properly — correct - Rollback path now passes `previousImageID` directly to `buildContainerOptions` instead of overwriting `opts.Image` after the fact — cleaner - New test (`TestBuildContainerOptionsUsesImageID`) validates the fix - Test helpers (`database/testing.go`, `logger/testing.go`, `export_test.go`) are clean **`make check`: PASS** — all tests pass, build succeeds. Labeled `merge-ready`, assigned to @sneak.
sneak merged commit 28f014ce95 into main 2026-02-23 20:48:23 +01:00
sneak deleted branch fix/use-image-id-in-container 2026-02-23 20:48:23 +01:00
Sign in to join this conversation.
No description provided.