Prepare references for artifact-only runs
This commit is contained in:
@@ -104,6 +104,13 @@ func prepareInputs(ctx context.Context, env *Env, m *manifest.Manifest, acquireA
|
||||
}
|
||||
|
||||
inputs := make([]manifest.InputRecord, 0, 9+len(resolvedLocalAudio))
|
||||
if !acquireAudio {
|
||||
for _, input := range m.Inputs {
|
||||
if input.Kind == "audio" {
|
||||
inputs = append(inputs, input)
|
||||
}
|
||||
}
|
||||
}
|
||||
registerInput := func(kind, path, checksum string) {
|
||||
inputs = append(inputs, manifest.InputRecord{Kind: kind, Path: path, Checksum: checksum})
|
||||
}
|
||||
|
||||
@@ -20,6 +20,18 @@ import (
|
||||
|
||||
const prepareResumeChangedReason = "prepared inputs or their current sources changed; rerun prepare"
|
||||
|
||||
// ValidateReferenceSources inspects the local sources used by reference-only
|
||||
// preparation without writing workspace files or contacting providers.
|
||||
func ValidateReferenceSources(ctx context.Context, env *Env, m *manifest.Manifest) error {
|
||||
if env == nil || env.Config == nil || env.Config.Session == nil || env.Config.Pipeline == nil || env.ArtifactStore == nil || m == nil {
|
||||
return fmt.Errorf("reference inspection requires resolved configuration, manifest, and artifact store")
|
||||
}
|
||||
copyEnv := *env
|
||||
copyEnv.Force = false
|
||||
_, err := currentPrepareSourceInputs(ctx, ©Env, m)
|
||||
return err
|
||||
}
|
||||
|
||||
type prepareExpectedInput struct {
|
||||
kind string
|
||||
destinationName string
|
||||
@@ -60,7 +72,16 @@ func (prepareStage) ValidateResume(ctx context.Context, env *Env, m *manifest.Ma
|
||||
return NonResumable(prepareResumeChangedReason), nil
|
||||
}
|
||||
}
|
||||
if !preparedInputRecordsCurrent(env, paths, m.Inputs) || !prepareSourceInputsMatch(paths, current, m.Inputs) {
|
||||
records := m.Inputs
|
||||
if !prepareNeedsAudio(env, m) {
|
||||
records = make([]manifest.InputRecord, 0, len(m.Inputs))
|
||||
for _, record := range m.Inputs {
|
||||
if record.Kind != "audio" {
|
||||
records = append(records, record)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !preparedInputRecordsCurrent(env, paths, records) || !prepareSourceInputsMatch(paths, current, records) {
|
||||
return NonResumable(prepareResumeChangedReason), nil
|
||||
}
|
||||
return Resumable(), nil
|
||||
|
||||
Reference in New Issue
Block a user