Update run reporting for catalog workflows
This commit is contained in:
@@ -7,17 +7,17 @@ import (
|
||||
)
|
||||
|
||||
type runSummary struct {
|
||||
dryRun bool
|
||||
planned int
|
||||
publishNew int
|
||||
replaceOlder int
|
||||
replaceConflict int
|
||||
replaceNewer int
|
||||
replaceTakeover int
|
||||
forceReplace int
|
||||
skipped int
|
||||
failures int
|
||||
fixedPath int
|
||||
dryRun bool
|
||||
planned int
|
||||
publishNew int
|
||||
upsertAdditive int
|
||||
replaceCatalog int
|
||||
skipSame int
|
||||
forceReplace int
|
||||
failUnmanaged int
|
||||
failConflict int
|
||||
failures int
|
||||
fixedPath int
|
||||
}
|
||||
|
||||
func (s *runSummary) recordPlan(action publish.Action) {
|
||||
@@ -25,18 +25,23 @@ func (s *runSummary) recordPlan(action publish.Action) {
|
||||
switch action {
|
||||
case publish.ActionPublishNew:
|
||||
s.publishNew++
|
||||
case publish.ActionReplaceOlder:
|
||||
s.replaceOlder++
|
||||
case publish.ActionReplaceConflict:
|
||||
s.replaceConflict++
|
||||
case publish.ActionReplaceNewer:
|
||||
s.replaceNewer++
|
||||
case publish.ActionReplaceTakeover:
|
||||
s.replaceTakeover++
|
||||
case publish.ActionUpsertAdditive:
|
||||
s.upsertAdditive++
|
||||
case publish.ActionReplaceCatalog:
|
||||
s.replaceCatalog++
|
||||
case publish.ActionForceReplace:
|
||||
s.forceReplace++
|
||||
case publish.ActionSkipSame, publish.ActionSkipDestinationNewer:
|
||||
s.skipped++
|
||||
s.skipSame++
|
||||
}
|
||||
}
|
||||
|
||||
func (s *runSummary) recordFailureAction(action string) {
|
||||
switch action {
|
||||
case string(publish.ActionFailUnmanaged):
|
||||
s.failUnmanaged++
|
||||
case string(publish.ActionFailConflict):
|
||||
s.failConflict++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,22 +54,22 @@ func (s *runSummary) recordFixedPath() {
|
||||
}
|
||||
|
||||
type RunSummaryCounters struct {
|
||||
Status string `json:"status"`
|
||||
Planned int `json:"planned"`
|
||||
PublishNew int `json:"publish_new"`
|
||||
ReplaceOlder int `json:"replace_older"`
|
||||
ReplaceConflict int `json:"replace_conflict"`
|
||||
ReplaceNewer int `json:"replace_newer"`
|
||||
ReplaceTakeover int `json:"replace_takeover"`
|
||||
ForceReplace int `json:"force_replace"`
|
||||
Skipped int `json:"skipped"`
|
||||
Failed int `json:"failed"`
|
||||
DryRun bool `json:"dry_run"`
|
||||
FixedPath int `json:"fixed_path"`
|
||||
Status string `json:"status"`
|
||||
Planned int `json:"planned"`
|
||||
PublishNew int `json:"publish_new"`
|
||||
UpsertAdditive int `json:"upsert_additive"`
|
||||
ReplaceCatalog int `json:"replace_catalog"`
|
||||
SkipSame int `json:"skip_same"`
|
||||
ForceReplace int `json:"force_replace"`
|
||||
FailUnmanaged int `json:"fail_unmanaged"`
|
||||
FailConflict int `json:"fail_conflict"`
|
||||
Failed int `json:"failed"`
|
||||
DryRun bool `json:"dry_run"`
|
||||
FixedPath int `json:"fixed_path"`
|
||||
}
|
||||
|
||||
func (s RunSummaryCounters) Line() string {
|
||||
return fmt.Sprintf("Final status: %s planned=%d publish_new=%d replace_older=%d replace_conflict=%d replace_newer=%d replace_takeover=%d force_replace=%d skipped=%d failed=%d dry_run=%t fixed_path=%d", s.Status, s.Planned, s.PublishNew, s.ReplaceOlder, s.ReplaceConflict, s.ReplaceNewer, s.ReplaceTakeover, s.ForceReplace, s.Skipped, s.Failed, s.DryRun, s.FixedPath)
|
||||
return fmt.Sprintf("Final status: %s planned=%d publish_new=%d upsert_additive=%d replace_catalog=%d skip_same=%d force_replace=%d fail_unmanaged=%d fail_conflict=%d failed=%d dry_run=%t fixed_path=%d", s.Status, s.Planned, s.PublishNew, s.UpsertAdditive, s.ReplaceCatalog, s.SkipSame, s.ForceReplace, s.FailUnmanaged, s.FailConflict, s.Failed, s.DryRun, s.FixedPath)
|
||||
}
|
||||
|
||||
func (s runSummary) Result() RunSummaryCounters {
|
||||
@@ -73,17 +78,17 @@ func (s runSummary) Result() RunSummaryCounters {
|
||||
status = "failed"
|
||||
}
|
||||
return RunSummaryCounters{
|
||||
Status: status,
|
||||
Planned: s.planned,
|
||||
PublishNew: s.publishNew,
|
||||
ReplaceOlder: s.replaceOlder,
|
||||
ReplaceConflict: s.replaceConflict,
|
||||
ReplaceNewer: s.replaceNewer,
|
||||
ReplaceTakeover: s.replaceTakeover,
|
||||
ForceReplace: s.forceReplace,
|
||||
Skipped: s.skipped,
|
||||
Failed: s.failures,
|
||||
DryRun: s.dryRun,
|
||||
FixedPath: s.fixedPath,
|
||||
Status: status,
|
||||
Planned: s.planned,
|
||||
PublishNew: s.publishNew,
|
||||
UpsertAdditive: s.upsertAdditive,
|
||||
ReplaceCatalog: s.replaceCatalog,
|
||||
SkipSame: s.skipSame,
|
||||
ForceReplace: s.forceReplace,
|
||||
FailUnmanaged: s.failUnmanaged,
|
||||
FailConflict: s.failConflict,
|
||||
Failed: s.failures,
|
||||
DryRun: s.dryRun,
|
||||
FixedPath: s.fixedPath,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user