Report structured session validation and inspection results
This commit is contained in:
@@ -156,49 +156,22 @@ func remotePublishedOutputAvailabilityForCurrent(
|
||||
catalog *artifacts.ArtifactCatalog,
|
||||
current *RemoteCurrentState,
|
||||
) map[string]string {
|
||||
state := "current"
|
||||
if current == nil || current.Commit == nil {
|
||||
return unresolvedRemotePublishedOutputAvailability(cfg, catalog, "remote=missing")
|
||||
state = "missing"
|
||||
}
|
||||
outcomes := committedPublishOutputOutcomes(current.Manifest)
|
||||
outputs, _ := inspectPublishedOutputs(ctx, cfg, store, catalog, current, nil, false, state)
|
||||
out := map[string]string{}
|
||||
for _, rule := range cfg.PublicationOutputs() {
|
||||
source := strings.TrimSpace(rule.Source)
|
||||
dest, _, err := helperPublishedOutputDest(rule, catalog)
|
||||
if err != nil {
|
||||
out[publishedOutputRemoteStateKey(source, "")] = "remote=error"
|
||||
continue
|
||||
for _, output := range outputs {
|
||||
value := ""
|
||||
if output.Outcome != "" {
|
||||
value = "outcome=" + output.Outcome + " "
|
||||
}
|
||||
outcome := outcomes[source]
|
||||
state := ""
|
||||
if outcome != "" {
|
||||
state = "outcome=" + outcome + " "
|
||||
value += "remote=" + output.State
|
||||
if output.State == "published" && current != nil && (output.Outcome == "carried_locked" || output.OriginRun != current.RunID) {
|
||||
value += " declared_dest=" + output.DeclaredDestination + " declared_key=" + output.DeclaredKey + " origin_run=" + output.OriginRun
|
||||
}
|
||||
declaration, ok := committedPublishedOutput(current.Commit, source)
|
||||
if !ok {
|
||||
out[publishedOutputRemoteStateKey(source, dest)] = state + "remote=missing"
|
||||
continue
|
||||
}
|
||||
identity, err := artifacts.ParsePublishedOutputObjectKey(current.SessionPrefix, declaration.DestinationKey)
|
||||
if err != nil {
|
||||
out[publishedOutputRemoteStateKey(source, dest)] = state + "remote=error"
|
||||
continue
|
||||
}
|
||||
exists, err := store.Exists(ctx, declaration.DestinationKey)
|
||||
if err != nil {
|
||||
out[publishedOutputRemoteStateKey(source, dest)] = state + "remote=error"
|
||||
continue
|
||||
}
|
||||
if !exists {
|
||||
out[publishedOutputRemoteStateKey(source, dest)] = state + "remote=missing"
|
||||
continue
|
||||
}
|
||||
state += "remote=published"
|
||||
if outcome == "carried_locked" || identity.RunID != current.RunID {
|
||||
state += " declared_dest=" + identity.Destination
|
||||
state += " declared_key=" + declaration.DestinationKey
|
||||
state += " origin_run=" + identity.RunID
|
||||
}
|
||||
out[publishedOutputRemoteStateKey(source, dest)] = state
|
||||
out[publishedOutputRemoteStateKey(output.Source, output.Destination)] = value
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user