Promote native Notarius lane products
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifactmodel"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
|
||||
)
|
||||
|
||||
@@ -13,11 +12,9 @@ import (
|
||||
const MaxExtractionPayloadBytes int64 = 64 * 1024 * 1024
|
||||
|
||||
const (
|
||||
extractStageName = "extract"
|
||||
extractionLaneKind = "notarius_lane"
|
||||
extractionIndexKind = "notarius_index"
|
||||
extractionMetadataRun = "narratio_run_id"
|
||||
extractionMetadataRoot = "bundle_root"
|
||||
extractStageName = "extract"
|
||||
extractionLaneKind = "notarius_lane"
|
||||
extractionMetadataRun = "narratio_run_id"
|
||||
)
|
||||
|
||||
// HydrateExtractionArtifacts marks extraction sources available only when the current
|
||||
@@ -47,28 +44,6 @@ func (c *ArtifactCatalog) HydrateExtractionArtifacts(
|
||||
}
|
||||
}
|
||||
|
||||
func compatibleCatalogExtractionContract(got *artifactmodel.ContractMetadata, want ExtractionArtifactDefinition) bool {
|
||||
return got != nil && got.MediaType == want.MediaType && got.SchemaID == want.SchemaID &&
|
||||
got.SchemaVersion == want.SchemaVersion && (want.ModuleKey == "" || got.ModuleKey == want.ModuleKey)
|
||||
}
|
||||
|
||||
func compatibleCatalogExtractionProvenance(
|
||||
got *artifactmodel.ExternalProvenance,
|
||||
runID, pipelineID string,
|
||||
want ExtractionArtifactDefinition,
|
||||
) bool {
|
||||
return got != nil && got.System == "notarius" && got.RunID == runID && got.PipelineID == pipelineID &&
|
||||
pipelineID == strings.TrimSpace(want.PipelineID) && got.ArtifactID == want.LaneID
|
||||
}
|
||||
|
||||
func safeExistingExtractionDirectory(sessionRoot, bundleRoot string) bool {
|
||||
if !pathWithinExtractionRoot(sessionRoot, bundleRoot) || !safeExtractionComponents(sessionRoot, bundleRoot) {
|
||||
return false
|
||||
}
|
||||
info, err := os.Lstat(bundleRoot)
|
||||
return err == nil && info.IsDir() && info.Mode()&os.ModeSymlink == 0
|
||||
}
|
||||
|
||||
func safeExtractionComponents(root, target string) bool {
|
||||
relative, err := filepath.Rel(filepath.Clean(root), filepath.Clean(target))
|
||||
if err != nil || relative == "." || relative == ".." || strings.HasPrefix(relative, ".."+string(filepath.Separator)) {
|
||||
@@ -99,8 +74,3 @@ func extractionMetadataString(metadata map[string]any, key string) string {
|
||||
value, _ := metadata[key].(string)
|
||||
return strings.TrimSpace(value)
|
||||
}
|
||||
|
||||
func extractionReceiptIdentity(metadata map[string]any) (string, string) {
|
||||
receipt, _ := metadata["receipt"].(map[string]any)
|
||||
return extractionMetadataString(receipt, "run_id"), extractionMetadataString(receipt, "pipeline_id")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user