Update run reporting for catalog workflows

This commit is contained in:
2026-06-19 15:50:09 +00:00
parent 52078e2195
commit 91b72478d5
9 changed files with 147 additions and 226 deletions

View File

@@ -60,7 +60,7 @@ func writeRunActionLine(w io.Writer, action RunActionRecord) {
fmt.Fprintf(w, " - bundle=%s destination=%s backend=%s%s action=error reason=%q\n", action.BundlePath, destinationID, action.Backend, pathMappingRecordSummary(action), action.Reason)
return
}
fmt.Fprintf(w, " - bundle=%s destination=%s backend=%s%s action=%s%s outputs=%s reason=%q\n", action.BundlePath, action.DestinationID, action.Backend, pathMappingRecordSummary(action), action.Action, takeoverModeRecordSummary(action), outputRecordSummary(action.Outputs), action.Reason)
fmt.Fprintf(w, " - bundle=%s destination=%s backend=%s%s action=%s%s outputs=%s reason=%q\n", action.BundlePath, action.DestinationID, action.Backend, pathMappingRecordSummary(action), action.Action, workflowRecordSummary(action), outputRecordSummary(action.Outputs), action.Reason)
}
func pathMappingRecordSummary(action RunActionRecord) string {
@@ -70,11 +70,11 @@ func pathMappingRecordSummary(action RunActionRecord) string {
return fmt.Sprintf(" path_mapping=fixed target=%s", action.DestinationPath)
}
func takeoverModeRecordSummary(action RunActionRecord) string {
if action.TakeoverMode == "" {
func workflowRecordSummary(action RunActionRecord) string {
if action.Workflow == "" {
return ""
}
return fmt.Sprintf(" takeover_mode=%s", action.TakeoverMode)
return fmt.Sprintf(" workflow=%s", action.Workflow)
}
func outputRecordSummary(outputs []RunOutputRecord) string {
@@ -143,8 +143,8 @@ type RunActionRecord struct {
BundlePath string `json:"bundle_path"`
DestinationPath string `json:"destination_path"`
PathMapping string `json:"path_mapping,omitempty"`
Workflow string `json:"workflow,omitempty"`
Action string `json:"action"`
TakeoverMode string `json:"takeover_mode,omitempty"`
PrimaryURL string `json:"primary_url,omitempty"`
Reason string `json:"reason,omitempty"`
Outputs []RunOutputRecord `json:"outputs"`
@@ -166,6 +166,13 @@ func runActionFromPlan(backend string, plan publish.Plan, planErr error) RunActi
if destinationID == "" {
destinationID = "unknown"
}
action := "error"
outputs := []RunOutputRecord{}
switch plan.Action {
case publish.ActionFailUnmanaged, publish.ActionFailConflict:
action = string(plan.Action)
outputs = runOutputsFromPlan(plan.Outputs)
}
return RunActionRecord{
PipelineID: plan.PipelineID,
DestinationID: destinationID,
@@ -174,10 +181,11 @@ func runActionFromPlan(backend string, plan publish.Plan, planErr error) RunActi
BundlePath: storage.DisplayPath(plan.BundlePath),
DestinationPath: storage.DisplayPath(plan.DestinationBundlePath),
PathMapping: plan.PathMapping,
Action: "error",
Workflow: plan.Workflow,
Action: action,
PrimaryURL: plan.PrimaryURL,
Reason: planErr.Error(),
Outputs: []RunOutputRecord{},
Outputs: outputs,
}
}
return RunActionRecord{
@@ -188,21 +196,14 @@ func runActionFromPlan(backend string, plan publish.Plan, planErr error) RunActi
BundlePath: storage.DisplayPath(plan.BundlePath),
DestinationPath: storage.DisplayPath(plan.DestinationBundlePath),
PathMapping: plan.PathMapping,
Workflow: plan.Workflow,
Action: string(plan.Action),
TakeoverMode: takeoverModeForAction(plan),
PrimaryURL: plan.PrimaryURL,
Reason: plan.Reason,
Outputs: runOutputsFromPlan(plan.Outputs),
}
}
func takeoverModeForAction(plan publish.Plan) string {
if plan.Action != publish.ActionReplaceTakeover {
return ""
}
return plan.TakeoverMode
}
func errorAction(pipelineID, destinationID, backend, bundlePath string, err error) RunActionRecord {
return RunActionRecord{
PipelineID: pipelineID,