Notify scripts: new abbrev tag simplification

This commit is contained in:
Václav Valíček (YCNet) 2018-03-02 11:25:49 +01:00
parent addf0ad77f
commit 0c76eb41c3
No known key found for this signature in database
GPG Key ID: 7CF44871CEA75938
3 changed files with 25 additions and 8 deletions

View File

@ -5,7 +5,10 @@
# #
# COMMIT - hash of commit # COMMIT - hash of commit
# COMMIT_AUTHOR - author of commit # COMMIT_AUTHOR - author of commit
# COMMIT_ABBREV - abbreviated sha
# COMMIT_LOG - short line of commit log
# COMMIT_BRANCH - name of branch # COMMIT_BRANCH - name of branch
# PROJECT_NAME - project name specified in cloner.cfg # PROJECT_NAME - project name specified in cloner.cfg
echo "Commit: ($COMMIT: (AUTHOR=$COMMIT_AUTHOR; BRANCH=$COMMIT_BRANCH), Project: $PROJECT_NAME)" echo "Commit: ($COMMIT: (AUTHOR=$COMMIT_AUTHOR; BRANCH=$COMMIT_BRANCH), Project: $PROJECT_NAME)"
echo -e "\t$COMMIT_ABBREV: $COMMIT_LOG"

View File

@ -1,4 +1,4 @@
#!/bin/bash #/bin/bash
# notify on tag push (new tag or change) # notify on tag push (new tag or change)
# #
# Parameters (via env) # Parameters (via env)
@ -6,6 +6,9 @@
# TAG_HASH - hash of tagged commit # TAG_HASH - hash of tagged commit
# TAG_NAME - tag label # TAG_NAME - tag label
# TAG_AUTHOR - who authored the tag - if available # 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 # PROJECT_NAME - name of project specified in cloner.cfg
echo "TAG: (Name=$TAG_NAME; AUTHOR=$TAG_AUTHOR; SHA: $TAG_HASH), PROJECT: $PROJECT_NAME" echo "TAG: (Name=$TAG_NAME; AUTHOR=$TAG_AUTHOR; SHA: $TAG_HASH), PROJECT: $PROJECT_NAME"
echo -e "\t$TAG_ABBREV: $TAG_LOG"

View File

@ -101,17 +101,23 @@ do
# COMMIT = $commitId # COMMIT = $commitId
# COMMIT_AUTHOR = $author # COMMIT_AUTHOR = $author
author=$(git --git-dir $repodir log $commitId -1 --format="%an <%ae>") 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 # BRANCH = $branch
# PORJECT_NAME = $cloner_project_name # PORJECT_NAME = $cloner_project_name
set +e set +e
env COMMIT="$commitId" \ COMMIT="$commitId" \
COMMIT_AUTHOR="$author" \ COMMIT_AUTHOR="$author" \
COMMIT_BRANCH="$branch" \ COMMIT_BRANCH="$branch" \
COMMIT_ABBREV="$abbr" \
COMMIT_LOG="$log" \
PROJECT_NAME="$cloner_project_name" \ PROJECT_NAME="$cloner_project_name" \
notify-commit notify-commit
rc=$? rc=$?
[ $rc -eq 0 ] || echo "Notify $branch/$commitId: return code = $rc" [ $rc -eq 0 ] || echo "Notify $branch/$commitId: return code = $rc"
set -e set -e
detectorSaveCommit $commitId detectorSaveCommit $commitId
fi fi
@ -144,15 +150,20 @@ do
# TAG_NAME = $tagname # TAG_NAME = $tagname
# TAG_AUTHOR # TAG_AUTHOR
author=$(git --git-dir $repodir log $newsha -1 --pretty=format:"%an <%ae>") 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 # PROJECT_NAME = $cloner_project_name
# call the notify script # call the notify script
set +e set +e
env TAG_HASH="$newsha" \ TAG_HASH="$newsha" \
TAG_NAME="$tagname" \ TAG_NAME="$tagname" \
TAG_AUTHOR="$author" \ TAG_AUTHOR="$author" \
PROJECT_NAME="$cloner_project_name" \ TAG_ABBREV="$abbr" \
notify-tag TAG_LOG="$log" \
PROJECT_NAME="$cloner_project_name" notify-tag
rc=$? rc=$?
[ $rc -eq 0 ] || echo "Notify $tagname: return code = $rc" [ $rc -eq 0 ] || echo "Notify $tagname: return code = $rc"
set -e set -e