Implemented new campaign/session stable inputs and corresponding input source references
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
This commit is contained in:
@@ -632,6 +632,16 @@ func resolveScriptoriumInput(
|
||||
if describeErr != nil {
|
||||
return "", false, nil, describeErr
|
||||
}
|
||||
if descriptor.Source.Kind == artifactpolicy.SourceKindStableInput {
|
||||
resolvedPath, ok, err := resolvePreparedStableInput(descriptor.Source.ID, paths)
|
||||
if err != nil {
|
||||
if inputCfg.Required {
|
||||
return "", false, nil, err
|
||||
}
|
||||
return "", false, nil, nil
|
||||
}
|
||||
return resolvedPath, ok, nil, nil
|
||||
}
|
||||
if descriptor.Source.Kind == artifactpolicy.SourceKindPreviousArtifact {
|
||||
resolved, err := artifacts.ResolvePreviousSessionArtifactWithCatalog(paths, m, source, runtimeCatalog)
|
||||
if err == nil {
|
||||
@@ -684,6 +694,36 @@ func resolveScriptoriumInput(
|
||||
}
|
||||
}
|
||||
|
||||
func resolvePreparedStableInput(sourceID string, paths artifacts.SessionPaths) (string, bool, error) {
|
||||
filename, ok := preparedStableInputFilename(sourceID)
|
||||
if !ok {
|
||||
return "", false, fmt.Errorf("unsupported prepared input source %q", sourceID)
|
||||
}
|
||||
path := filepath.Join(paths.InputsDir, filename)
|
||||
if err := requireNonEmptyFile(path, "prepared input "+sourceID); err != nil {
|
||||
return "", false, fmt.Errorf(
|
||||
"prepared input source %q is unavailable; run narratio run-stage prepare %s --force: %w",
|
||||
sourceID,
|
||||
paths.SessionID,
|
||||
err,
|
||||
)
|
||||
}
|
||||
return path, true, nil
|
||||
}
|
||||
|
||||
func preparedStableInputFilename(sourceID string) (string, bool) {
|
||||
switch strings.TrimSpace(sourceID) {
|
||||
case artifactpolicy.SourceInputPlayers:
|
||||
return "players.yml", true
|
||||
case artifactpolicy.SourceInputParty:
|
||||
return "party.yml", true
|
||||
case artifactpolicy.SourceInputGlossary:
|
||||
return "glossary.yml", true
|
||||
default:
|
||||
return "", false
|
||||
}
|
||||
}
|
||||
|
||||
func buildAnalyzeRuntimeArtifactCatalog(
|
||||
paths artifacts.SessionPaths,
|
||||
scriptoriumCfg *config.ScriptoriumConfig,
|
||||
|
||||
Reference in New Issue
Block a user