Isolate invocation collaborator composition

This commit is contained in:
2026-09-04 01:11:11 +00:00
parent e0f19833a1
commit 8afe9427ca
10 changed files with 255 additions and 130 deletions

View File

@@ -12,9 +12,14 @@ import (
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
)
var removeRunScopedDirFn = removeRunScopedDir
func runPostPublishCleanup(ctx context.Context, env *Env, manifestPath string, m *manifest.Manifest, executed []string) error {
func runPostPublishCleanup(
ctx context.Context,
env *Env,
manifestPath string,
m *manifest.Manifest,
executed []string,
removeScopedDir func(root, target, policy string) error,
) error {
if env == nil || env.Config == nil || env.Config.Pipeline == nil || m == nil {
return nil
}
@@ -40,7 +45,7 @@ func runPostPublishCleanup(ctx context.Context, env *Env, manifestPath string, m
if target.Completed {
continue
}
if err := removeRunScopedDirFn(target.Root, target.Path, target.Policy); err != nil {
if err := removeScopedDir(target.Root, target.Path, target.Policy); err != nil {
return fmt.Errorf("complete post-publish cleanup for %q: %w", target.Path, err)
}
target.Completed = true