Move attempt views to workspace path ownership
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/fileops"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
|
||||
)
|
||||
@@ -47,7 +48,7 @@ func (cleanupStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
}
|
||||
_, err := inspectCleanupTarget(target.root, target.target)
|
||||
if err == nil {
|
||||
err = fileops.RemoveManagedAttemptViews(filepath.Dir(target.target), cleanupManagedNames())
|
||||
err = artifacts.RemoveManagedAttemptViews(filepath.Dir(target.target), cleanupManagedNames())
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
err = nil
|
||||
}
|
||||
@@ -165,7 +166,7 @@ func inspectCleanupTarget(workspaceRoot, runsDir string) (bool, error) {
|
||||
if runsExist && (!info.IsDir() || info.Mode()&os.ModeSymlink != 0) {
|
||||
return false, fmt.Errorf("unsafe run cleanup directory %q", runsDir)
|
||||
}
|
||||
viewsExist, err := fileops.InspectManagedAttemptViews(session, cleanupManagedNames())
|
||||
viewsExist, err := artifacts.InspectManagedAttemptViews(session, cleanupManagedNames())
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifacts"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/fileops"
|
||||
)
|
||||
|
||||
func TestCleanupStageDisabledSelfSkips(t *testing.T) {
|
||||
@@ -35,7 +34,7 @@ func TestCleanupRemovesSessionRunsAndManagedViews(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, pair := range [][2]string{{published, "polish"}, {"older-failure", "extract"}, {"restore-run", "restore"}} {
|
||||
if _, err := fileops.BeginAttemptViews(session.Root, pair[0], pair[1]); err != nil {
|
||||
if _, err := artifacts.BeginAttemptViews(session.Root, pair[0], pair[1]); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
writeStageTestFile(t, filepath.Join(session.RunsDir, pair[0], pair[1], "logs", "diagnostic"), "data")
|
||||
|
||||
Reference in New Issue
Block a user