Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/foundryctl/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func runCast(ctx context.Context, logger *slog.Logger, poursPath string, configP
}
}

err = foundry.Cast(ctx, machineries, poursPath)
return props, err
for _, machinery := range machineries {
if err := foundry.Cast(ctx, machinery, poursPath); err != nil {
return props, err
}
}

return props, nil
}
13 changes: 11 additions & 2 deletions cmd/foundryctl/forge.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func runForge(ctx context.Context, logger *slog.Logger, path string, poursPath s
return domain.NewProperties(), err
}

if err := foundry.Config.PruneV1Alpha1Lock(ctx, machineries, path); err != nil {
return domain.NewProperties(), err
}

props := domain.NewProperties()
for _, machinery := range machineries {
if machinery.Kind() == v1alpha1.KindInstallation {
Expand All @@ -49,6 +53,11 @@ func runForge(ctx context.Context, logger *slog.Logger, path string, poursPath s
return props, err
}

err = foundry.Forge(ctx, machineries, path, &writer.Options{Output: &os.File{}, TargetDirectory: poursAbsPath})
return props, err
for _, machinery := range machineries {
if err := foundry.Forge(ctx, machinery, path, &writer.Options{Output: &os.File{}, TargetDirectory: poursAbsPath}); err != nil {
return props, err
}
}

return props, nil
}
10 changes: 8 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ type Config interface {
// document the file holds, and returns them in cast order.
GetV1Alpha1(ctx context.Context, path string) ([]v1alpha1.Machinery, error)

// CreateV1Alpha1Lock writes the resolved castings to the lock file.
CreateV1Alpha1Lock(ctx context.Context, machineries []v1alpha1.Machinery, path string) error
// CreateOrUpdateV1Alpha1Lock replaces the casting's entry in the lock file,
// keeping every other entry. A missing lock starts empty.
CreateOrUpdateV1Alpha1Lock(ctx context.Context, machinery v1alpha1.Machinery, path string) error

// PruneV1Alpha1Lock drops lock entries for castings the file no longer
// declares; entries for declared castings are untouched. A lock left with
// no entries is removed.
PruneV1Alpha1Lock(ctx context.Context, declared []v1alpha1.Machinery, path string) error

// GetV1Alpha1Lock reads the lock file from disk.
GetV1Alpha1Lock(ctx context.Context, path string) ([]v1alpha1.Machinery, error)
Expand Down
Loading
Loading