From 0c76eb41c339614b0f83ccf9f135d410053e8d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek=20=28YCNet=29?= Date: Fri, 2 Mar 2018 11:25:49 +0100 Subject: [PATCH] Notify scripts: new abbrev tag simplification --- checker/notify-commit | 3 +++ checker/notify-tag | 5 ++++- checker/run-checker | 25 ++++++++++++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/checker/notify-commit b/checker/notify-commit index de17493..5cf487b 100755 --- a/checker/notify-commit +++ b/checker/notify-commit @@ -5,7 +5,10 @@ # # COMMIT - hash of commit # COMMIT_AUTHOR - author of commit +# COMMIT_ABBREV - abbreviated sha +# COMMIT_LOG - short line of commit log # COMMIT_BRANCH - name of branch # PROJECT_NAME - project name specified in cloner.cfg echo "Commit: ($COMMIT: (AUTHOR=$COMMIT_AUTHOR; BRANCH=$COMMIT_BRANCH), Project: $PROJECT_NAME)" +echo -e "\t$COMMIT_ABBREV: $COMMIT_LOG" diff --git a/checker/notify-tag b/checker/notify-tag index 11aeb92..bbea1af 100755 --- a/checker/notify-tag +++ b/checker/notify-tag @@ -1,4 +1,4 @@ -#!/bin/bash +#/bin/bash # notify on tag push (new tag or change) # # Parameters (via env) @@ -6,6 +6,9 @@ # TAG_HASH - hash of tagged commit # TAG_NAME - tag label # TAG_AUTHOR - who authored the tag - if available +# TAG_ABBREV - commit abbreviated hash +# TAG_LOG - short status line of log # PROJECT_NAME - name of project specified in cloner.cfg echo "TAG: (Name=$TAG_NAME; AUTHOR=$TAG_AUTHOR; SHA: $TAG_HASH), PROJECT: $PROJECT_NAME" +echo -e "\t$TAG_ABBREV: $TAG_LOG" diff --git a/checker/run-checker b/checker/run-checker index bf4cc2b..8b44399 100755 --- a/checker/run-checker +++ b/checker/run-checker @@ -101,17 +101,23 @@ do # COMMIT = $commitId # COMMIT_AUTHOR = $author author=$(git --git-dir $repodir log $commitId -1 --format="%an <%ae>") + # COMMIT_ABBREV + abbr=$(git --git-dir $repodir log $commitId -1 --format="%h") + # COMMIT_LOG + log=$(git --git-dir $repodir log $commitId -1 --format="%s") # BRANCH = $branch # PORJECT_NAME = $cloner_project_name set +e - env COMMIT="$commitId" \ + COMMIT="$commitId" \ COMMIT_AUTHOR="$author" \ COMMIT_BRANCH="$branch" \ + COMMIT_ABBREV="$abbr" \ + COMMIT_LOG="$log" \ PROJECT_NAME="$cloner_project_name" \ notify-commit - rc=$? - [ $rc -eq 0 ] || echo "Notify $branch/$commitId: return code = $rc" + rc=$? + [ $rc -eq 0 ] || echo "Notify $branch/$commitId: return code = $rc" set -e detectorSaveCommit $commitId fi @@ -144,15 +150,20 @@ do # TAG_NAME = $tagname # TAG_AUTHOR author=$(git --git-dir $repodir log $newsha -1 --pretty=format:"%an <%ae>") + # TAG_ABBREV + abbr=$(git --git-dir $repodir log $newsha -1 --format="%h") + # TAG_LOG + log=$(git --git-dir $repodir log $newsha -1 --format="%s") # PROJECT_NAME = $cloner_project_name - + # call the notify script set +e - env TAG_HASH="$newsha" \ + TAG_HASH="$newsha" \ TAG_NAME="$tagname" \ TAG_AUTHOR="$author" \ - PROJECT_NAME="$cloner_project_name" \ - notify-tag + TAG_ABBREV="$abbr" \ + TAG_LOG="$log" \ + PROJECT_NAME="$cloner_project_name" notify-tag rc=$? [ $rc -eq 0 ] || echo "Notify $tagname: return code = $rc" set -e