Add artifact workdir layout and locking
This commit is contained in:
@@ -6,10 +6,11 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/config"
|
||||
)
|
||||
|
||||
// Plan validates configuration inputs and reports readiness for future planning.
|
||||
// Plan validates configuration inputs and prepares the local session workdir.
|
||||
func Plan(_ context.Context, args []string, out io.Writer) error {
|
||||
fs := flag.NewFlagSet("plan", flag.ContinueOnError)
|
||||
fs.SetOutput(io.Discard)
|
||||
@@ -37,6 +38,12 @@ func Plan(_ context.Context, args []string, out io.Writer) error {
|
||||
return fmt.Errorf("plan: %w", err)
|
||||
}
|
||||
|
||||
_, err = fmt.Fprintln(out, "narratio plan: configuration loaded and valid")
|
||||
store := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root)
|
||||
paths, err := store.EnsureLayout(cfg.Session.SessionID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("plan: prepare workdir: %w", err)
|
||||
}
|
||||
|
||||
_, err = fmt.Fprintf(out, "narratio plan: configuration loaded and valid; workdir prepared at %s\n", paths.Root)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user