diff options
| author | fumingwei <[email protected]> | 2024-02-04 11:53:54 +0800 |
|---|---|---|
| committer | 付明卫 <[email protected]> | 2024-02-04 09:47:27 +0000 |
| commit | c4e6ab1f701fc1e8735488dcdf81df209a42e877 (patch) | |
| tree | d3d4b9fc5164d8087b02ca98d0925999cbf9f9a3 /tools | |
| parent | 57dbca0d5b4a41d0ea3eb2d244521cc0029f8002 (diff) | |
feature:add notify jobs done status by webhook
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/notify-jobs-done.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/notify-jobs-done.sh b/tools/notify-jobs-done.sh new file mode 100644 index 00000000..c10bbbcb --- /dev/null +++ b/tools/notify-jobs-done.sh @@ -0,0 +1,18 @@ +#!/bin/sh -x +ls -halt $CI_PROJECT_DIR/images/ +TSG_OS_VERSION_FILE="$CI_PROJECT_DIR/images/tsg-os-version.txt" + + +TSG_OS_VERSION= +if [ -f $TSG_OS_VERSION_FILE ]; then TSG_OS_VERSION=$(cat $TSG_OS_VERSION_FILE); fi +echo $TSG_OS_VERSION + +NOTIFY_CONTENT="{\"msgtype\": \"text\",\"text\": {\"content\": \"TSG-OS version: $TSG_OS_VERSION has been generated.\",\"mentioned_list\":[\"@all\"]}}" +echo $NOTIFY_CONTENT + +if [ -z "$TSG_OS_VERSION" ]; then echo "TSG_OS version: $TSG_OS_VERSION is NULL."; exit 1; fi +if [ -n "$ENABLE_NOTIFY_TESTING_JOBS_DONE" ] && [ "$ENABLE_NOTIFY_TESTING_JOBS_DONE" == "1" ]; then curl "$NOTIFY_TESTING_JOBS_DONE_WEBHOOK" -H "Content-Type: application/json" -d "$NOTIFY_CONTENT"; fi +if [ -n "$ENABLE_NOTIFY_RC_JOBS_DONE" ] && [ "$ENABLE_NOTIFY_RC_JOBS_DONE" == "1" ]; then curl "$NOTIFY_RC_JOBS_DONE_WEBHOOK" -H "Content-Type: application/json" -d "$NOTIFY_CONTENT"; fi +if [ -n "$ENABLE_NOTIFY_RELEASE_JOBS_DONE" ] && [ "$ENABLE_NOTIFY_RELEASE_JOBS_DONE" == "1" ]; then curl "$NOTIFY_RELEASE_JOBS_DONE_WEBHOOK" -H "Content-Type: application/json" -d "$NOTIFY_CONTENT"; fi + +rm -rf $TSG_OS_VERSION_FILE
\ No newline at end of file |
