Skip to content

Commit 87ad82d

Browse files
committed
fix(macos): add e2fsprogs PATH and don't cache failed image builds
- Makefile: prepend e2fsprogs sbin to PATH for dev-darwin and run-darwin targets so mkfs.ext4 is found without requiring shell profile changes - manager.go: don't cache failed image builds, clean up failed build directory to allow retries after fixing the underlying issue
1 parent 72d4f7e commit 87ad82d

2 files changed

Lines changed: 36 additions & 21 deletions

File tree

‎Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ sign-darwin-identity: build-darwin
308308
# macOS development mode with hot reload (uses vz, no sudo needed)
309309
dev-darwin: build-embedded $(AIR)
310310
@rm -f ./tmp/main
311-
$(AIR) -c .air.darwin.toml
311+
PATH="/opt/homebrew/opt/e2fsprogs/sbin:$(PATH)" $(AIR) -c .air.darwin.toml
312312

313313
# Run without hot reload (for testing)
314314
run:
@@ -322,7 +322,7 @@ run-linux: ensure-ch-binaries ensure-caddy-binaries build-embedded build
322322
./bin/hypeman
323323

324324
run-darwin: sign-darwin
325-
./bin/hypeman
325+
PATH="/opt/homebrew/opt/e2fsprogs/sbin:$(PATH)" ./bin/hypeman
326326

327327
# Quick test of vz package compilation
328328
.PHONY: test-vz-compile

‎lib/images/manager.go‎

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,26 @@ func (m *manager) CreateImage(ctx context.Context, req CreateImageRequest) (*Ima
113113

114114
// Check if we already have this digest (deduplication)
115115
if meta, err := readMetadata(m.paths, ref.Repository(), ref.DigestHex()); err == nil {
116-
// We have this digest already
117-
if meta.Status == StatusReady && ref.Tag() != "" {
118-
// Update tag symlink to point to current digest
119-
// (handles case where tag moved to new digest)
120-
createTagSymlink(m.paths, ref.Repository(), ref.Tag(), ref.DigestHex())
121-
}
122-
img := meta.toImage()
123-
// Add queue position if pending
124-
if meta.Status == StatusPending {
125-
img.QueuePosition = m.queue.GetPosition(meta.Digest)
116+
// Don't cache failed builds - allow retry
117+
if meta.Status == StatusFailed {
118+
// Clean up the failed build directory so we can retry
119+
digestDir := filepath.Join(m.paths.ImagesDir(), ref.Repository(), ref.DigestHex())
120+
os.RemoveAll(digestDir)
121+
// Fall through to re-queue the build
122+
} else {
123+
// We have this digest already (ready, pending, pulling, or converting)
124+
if meta.Status == StatusReady && ref.Tag() != "" {
125+
// Update tag symlink to point to current digest
126+
// (handles case where tag moved to new digest)
127+
createTagSymlink(m.paths, ref.Repository(), ref.Tag(), ref.DigestHex())
128+
}
129+
img := meta.toImage()
130+
// Add queue position if pending
131+
if meta.Status == StatusPending {
132+
img.QueuePosition = m.queue.GetPosition(meta.Digest)
133+
}
134+
return img, nil
126135
}
127-
return img, nil
128136
}
129137

130138
// Don't have this digest yet, queue the build
@@ -156,15 +164,22 @@ func (m *manager) ImportLocalImage(ctx context.Context, repo, reference, digest
156164

157165
// Check if we already have this digest (deduplication)
158166
if meta, err := readMetadata(m.paths, ref.Repository(), ref.DigestHex()); err == nil {
159-
// We have this digest already
160-
if meta.Status == StatusReady && ref.Tag() != "" {
161-
createTagSymlink(m.paths, ref.Repository(), ref.Tag(), ref.DigestHex())
162-
}
163-
img := meta.toImage()
164-
if meta.Status == StatusPending {
165-
img.QueuePosition = m.queue.GetPosition(meta.Digest)
167+
// Don't cache failed builds - allow retry
168+
if meta.Status == StatusFailed {
169+
digestDir := filepath.Join(m.paths.ImagesDir(), ref.Repository(), ref.DigestHex())
170+
os.RemoveAll(digestDir)
171+
// Fall through to re-queue the build
172+
} else {
173+
// We have this digest already
174+
if meta.Status == StatusReady && ref.Tag() != "" {
175+
createTagSymlink(m.paths, ref.Repository(), ref.Tag(), ref.DigestHex())
176+
}
177+
img := meta.toImage()
178+
if meta.Status == StatusPending {
179+
img.QueuePosition = m.queue.GetPosition(meta.Digest)
180+
}
181+
return img, nil
166182
}
167-
return img, nil
168183
}
169184

170185
// Don't have this digest yet, queue the build

0 commit comments

Comments
 (0)