worker: bake dotfiles pi config (filtered) + shared lvmh-pi-cache volume; CopyToContainer seeding

This commit is contained in:
Raphael Westphal
2026-08-18 16:59:51 +02:00
parent 55be4b2a38
commit 95deb650cb
6 changed files with 57 additions and 5 deletions
+10 -1
View File
@@ -41,6 +41,8 @@ const (
labelSession string = "lvmh.session"
volumeRepoPrefix string = "lvmh-repo-"
volumeSessions string = "lvmh-sessions"
volumePiCache string = "lvmh-pi-cache" // pi package cache (git:/npm:), shared across spawns
cacheMount string = "/root/.pi/agent/cache"
workspaceMount string = "/workspace"
sessionsMount string = "/pi-sessions"
@@ -382,8 +384,15 @@ func (s *Spawner) createAndStart(ctx context.Context, repo, slug, sessionID stri
if _, err := s.cli.VolumeCreate(ctx, volume.CreateOptions{Name: volumeSessions}); err != nil {
return "", fmt.Errorf("volume %s: %w", volumeSessions, err)
}
if _, err := s.cli.VolumeCreate(ctx, volume.CreateOptions{Name: volumePiCache}); err != nil {
return "", fmt.Errorf("volume %s: %w", volumePiCache, err)
}
binds := []string{repoVolume + ":" + workspaceMount, volumeSessions + ":" + sessionsMount}
binds := []string{
repoVolume + ":" + workspaceMount,
volumeSessions + ":" + sessionsMount,
volumePiCache + ":" + cacheMount,
}
cfg := &container.Config{
Image: imageRefWorker,
Env: []string{
+3 -2
View File
@@ -77,9 +77,10 @@ func TestSpawnerStartHappyPath(t *testing.T) {
wantBinds := []string{
"lvmh-repo-group-project:" + workspaceMount,
volumeSessions + ":" + sessionsMount,
volumePiCache + ":" + cacheMount,
}
if len(c.HostConfig.Binds) != 2 {
t.Fatalf("binds = %v, want %v (no models file)", c.HostConfig.Binds, wantBinds)
if len(c.HostConfig.Binds) != 3 {
t.Fatalf("binds = %v, want %v", c.HostConfig.Binds, wantBinds)
}
for i, b := range wantBinds {
if c.HostConfig.Binds[i] != b {