Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Better output in runner ⚓ #105

Merged
merged 2 commits into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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