Commit 68b532b6 authored by Stephan Großberndt's avatar Stephan Großberndt

[TASK] Improve logging of hooks

* log hook name and arguments once per hook
* add newline after each hook file execution
* fix shellcheck issues
* remove extra logging in update-forge-issue hook
parent 945ac63b
#!/bin/bash
HOOK=$0
HOOK_NAME=$(basename $0)
HOOK_NAME=$(basename "$0")
for file in $HOOK.d/*; do
if [[ -x "$file" ]]; then
echo "Executing hook $HOOK_NAME file $file" >> /var/gerrit/logs/change-merged.log
$file --action $HOOK "$@" >> /var/gerrit/logs/change-merged.log
fi
done
{
echo "Executing ${HOOK_NAME} with arguments $*"
for file in "${HOOK}".d/*; do
if [[ -x "$file" ]]; then
echo "Executing $file:"
$file --action "${HOOK}" "$@"
echo ""
fi
done
} >>/var/gerrit/logs/change_merged_log
#!/bin/bash
HOOK=$0
HOOK_NAME=$(basename $0)
HOOK_NAME=$(basename "$0")
for file in $HOOK.d/*; do
if [[ -x "$file" ]]; then
echo "Executing hook $HOOK_NAME file $file" >> /var/gerrit/logs/patchset-created.log
$file --action $HOOK "$@" >> /var/gerrit/logs/patchset-created.log
fi
done
{
echo "Executing ${HOOK_NAME} with arguments $*"
for file in "${HOOK}".d/*; do
if [[ -x "$file" ]]; then
echo "Executing $file:"
$file --action "${HOOK}" "$@"
echo ""
fi
done
} >>/var/gerrit/logs/patchset_created_log
......@@ -6,15 +6,6 @@ require_once dirname(__FILE__) . '/../get-commit-message.php';
$args = getArguments();
// log input parameters
$parametersGiven = [];
foreach ($args as $key => $value) {
$parametersGiven[] = $key . ':' . $value;
}
echo 'Executing hook file ' . __FILE__ . ' (' . implode(', ', $parametersGiven) . ')';
unset($parametersGiven);
// fetch commit message
$commitInfo = getCommitMessage($args['project'], $args['commit']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment