Skip to content

Commit bf57cdc

Browse files
authored
fix(stack): preload openclaw image in dev k3d (#352)
1 parent 529bc6d commit bf57cdc

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

internal/openclaw/openclaw.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ func openclawImageTag() string {
7575
return ""
7676
}
7777

78+
// ImageRef returns the pinned OpenClaw image reference used by the local
79+
// binary when it writes overlay values. Empty string means no explicit ref.
80+
func ImageRef() string {
81+
if tag := openclawImageTag(); tag != "" {
82+
return "ghcr.io/obolnetwork/openclaw:" + tag
83+
}
84+
return ""
85+
}
86+
7887
// OnboardOptions contains options for the onboard command
7988
type OnboardOptions struct {
8089
ID string // Deployment ID (empty = generate petname)

internal/stack/stack.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,14 @@ var localImages = []localImage{
696696
{tag: "ghcr.io/obolnetwork/x402-buyer:latest", dockerfile: "Dockerfile.x402-buyer"},
697697
}
698698

699+
func devPreloadImages() []string {
700+
var images []string
701+
if ref := openclaw.ImageRef(); ref != "" {
702+
images = append(images, ref)
703+
}
704+
return images
705+
}
706+
699707
// buildAndImportLocalImages builds Docker images from source and imports them
700708
// into the k3d cluster. This ensures images are available even when the GHCR
701709
// publish workflow hasn't run. Non-fatal: logs warnings on failure.
@@ -741,6 +749,20 @@ func buildAndImportLocalImages(cfg *config.Config) {
741749
fmt.Printf("Warning: failed to import %s into k3d: %v\n", img.tag, err)
742750
}
743751
}
752+
753+
for _, ref := range devPreloadImages() {
754+
fmt.Printf("Preloading %s into cluster %s...\n", ref, clusterName)
755+
pullCmd := exec.Command("docker", "pull", ref)
756+
pullCmd.Stdout = os.Stdout
757+
pullCmd.Stderr = os.Stderr
758+
if err := pullCmd.Run(); err != nil {
759+
fmt.Printf("Warning: failed to pull %s: %v\n", ref, err)
760+
continue
761+
}
762+
if err := importImageToCluster(k3dBinary, clusterName, ref); err != nil {
763+
fmt.Printf("Warning: failed to import %s into k3d: %v\n", ref, err)
764+
}
765+
}
744766
}
745767

746768
func importImageToCluster(k3dBinary, clusterName, tag string) error {

0 commit comments

Comments
 (0)