worker: bake dotfiles pi config (filtered) + shared lvmh-pi-cache volume; CopyToContainer seeding
This commit is contained in:
+10
-1
@@ -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{
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user