MCPcopy
hub / github.com/slimtoolkit/slim / Archive

Method Archive

pkg/app/sensor/artifact/artifact.go:463–499  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

461}
462
463func (a *processor) Archive() error {
464 toArchive := map[string]struct{}{}
465 for _, f := range a.artifactsExtra {
466 if fsutil.Exists(f) {
467 toArchive[f] = struct{}{}
468 }
469 }
470
471 artifacts, err := os.ReadDir(a.artifactsDirName)
472 if err != nil {
473 return err
474 }
475
476 // We archive everything in the /opt/_slim/artifacts folder
477 // except (potentially large data) `files` and `files.tar` entries.
478 // and the monitor data event log
479 // (which is used for local debugging or it should be streamed out of band)
480 // In particular, this may include:
481 // - creport.json
482 // - events.json
483 // - app_stdout.log
484 // - app_stderr.log
485 for _, f := range artifacts {
486 if f.Name() != app.ArtifactFilesDirName &&
487 f.Name() != filesArchiveName &&
488 f.Name() != report.DefaultMonDelFileName {
489 toArchive[filepath.Join(a.artifactsDirName, f.Name())] = struct{}{}
490 }
491 }
492
493 var toArchiveList []string
494 for name := range toArchive {
495 toArchiveList = append(toArchiveList, name)
496 }
497 return fsutil.ArchiveFiles(
498 filepath.Join(a.artifactsDirName, runArchiveName), toArchiveList, false, "")
499}
500
501func saveResults(
502 origPathMap map[string]struct{},

Callers

nothing calls this directly

Calls 3

ExistsFunction · 0.92
ArchiveFilesFunction · 0.92
NameMethod · 0.65

Tested by

no test coverage detected