Verify imported products through publication and local execution

This commit is contained in:
2026-12-02 16:33:08 +00:00
parent e7fada4372
commit 56483f9064
7 changed files with 334 additions and 33 deletions

View File

@@ -54,7 +54,7 @@ func (publishStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
}, nil
}
if err := validatePublishPrerequisites(m); err != nil {
if err := validatePublishPrerequisites(env, m); err != nil {
return nil, fmt.Errorf("publish: %w", err)
}
if env.ObjectStore == nil {
@@ -222,10 +222,30 @@ func publishRunUploadDisabled(env *Env) bool {
return cfg.UploadRun != nil && !*cfg.UploadRun
}
func validatePublishPrerequisites(m *manifest.Manifest) error {
func validatePublishPrerequisites(env *Env, m *manifest.Manifest) error {
if m == nil {
return fmt.Errorf("manifest is required")
}
// Imported products carry their own local availability evidence. The
// publication resolver below independently validates each selected source,
// so their absent historical producer statuses are not prerequisites.
if m.SuppliedProducts != nil && env != nil && env.Config != nil && env.Config.Pipeline != nil && env.Config.Session != nil {
paths := publishSessionPaths(env, m)
catalog, err := newPublishArtifactCatalog(env.Config.ConcreteArtifacts(), env.Config.Pipeline.Notarius)
if err != nil {
return err
}
for source, product := range m.SuppliedProducts.Products {
entry, ok := catalog.Lookup(source)
if !ok {
continue
}
canonical, err := artifacts.ProductRelativePath(paths.Root, entry.CanonicalRelPath)
if err == nil && artifacts.ValidateSuppliedProduct(paths, source, canonical, product) == nil {
return nil
}
}
}
for _, stageName := range publishPrerequisiteStages {
sr := m.Stages[stageName]
if sr == nil {

View File

@@ -112,6 +112,11 @@ func collectPublishRunFiles(runRoot string, sessionManifest *manifest.Manifest)
if strings.TrimSpace(path) == "" {
return nil
}
// Relative artifact records are session-relative, not paths inside the
// current run archive. Only actual run-local paths belong in this upload.
if !filepath.IsAbs(path) {
return nil
}
rel, err := pathsafe.SlashRelativeFromRoot(runRoot, path)
if err != nil {
return nil