Skip to content

Commit

Permalink
fix: Better output in runner ⚓ (#105)
Browse files Browse the repository at this point in the history
- Add some simple summary what is executed in parallel, do better visually
  determine whats going on.
  • Loading branch information
gabyx authored Mar 16, 2023
1 parent 3f9b4e8 commit fa10f56
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions githooks/apps/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -975,33 +975,45 @@ func executeHooks(settings *HookSettings, hs *hooks.Hooks) {
log.DebugF("Hooks priority list written to '%s'.", file.Name())
}

log.DebugIf(len(hs.LocalHooks) != 0, "Launching local hooks ...")
log.InfoIfF(
len(hs.LocalHooks) != 0,
"Launching '%s' local hooks [threads: '%s'] ...",
len(hs.LocalHooks), nThreads)
results, err = hooks.ExecuteHooksParallel(
pool, &settings.ExecX, hs.LocalHooks,
results, logHookResults,
settings.Args...)
log.AssertNoErrorPanic(err, "Local hook execution failed.")

log.DebugIf(len(hs.RepoSharedHooks) != 0, "Launching repository shared hooks ...")
log.InfoIfF(
len(hs.RepoSharedHooks) != 0,
"Launching '%s' repository shared hooks [threads: '%s']...",
len(hs.RepoSharedHooks), nThreads)
results, err = hooks.ExecuteHooksParallel(
pool, &settings.ExecX, hs.RepoSharedHooks,
results, logHookResults,
settings.Args...)
log.AssertNoErrorPanic(err, "Shared repository hook execution failed.")

log.DebugIf(len(hs.LocalSharedHooks) != 0, "Launching local shared hooks ...")
log.InfoIfF(
len(hs.LocalSharedHooks) != 0,
"Launching '%s' local shared hooks [threads: '%s']...",
len(hs.LocalSharedHooks), nThreads)
results, err = hooks.ExecuteHooksParallel(
pool, &settings.ExecX, hs.LocalSharedHooks,
results, logHookResults,
settings.Args...)
log.AssertNoErrorPanic(err, "Local shared hook execution failed.")

log.DebugIf(len(hs.GlobalSharedHooks) != 0, "Launching global shared hooks ...")
log.InfoIfF(
len(hs.GlobalSharedHooks) != 0,
"Launching '%s' global shared hooks [threads: '%s']...",
len(hs.GlobalSharedHooks), nThreads)
_, err = hooks.ExecuteHooksParallel(
pool, &settings.ExecX, hs.GlobalSharedHooks,
results, logHookResults,
settings.Args...)
log.AssertNoErrorPanic(err, "Gobal shared hook execution failed.")
log.AssertNoErrorPanic(err, "Global shared hook execution failed.")
}

func logHookResults(res ...hooks.HookResult) {
Expand Down

0 comments on commit fa10f56

Please sign in to comment.