]> git.corax.cc Git - foundry/commitdiff
testbot: Remove handling of "commit" and "logs" message properties
authorMatthias Kruk <m@m10k.eu>
Sun, 1 Aug 2021 07:01:18 +0000 (16:01 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 1 Aug 2021 07:01:18 +0000 (16:01 +0900)
The "commit" message property has been made optional, and the "logs"
property has been removed, making it necessary to change the way
testbots handle IPC messages.
This commit modifies testbot so that the "commit" property will be
ignored, and that testbots will not attempt to include testlogs
in sent messages.

testbot.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 9e188c3..17dc5b4
@@ -3,7 +3,6 @@
 test_source_tree() {
        local repository="$1"
        local branch="$2"
-       local commit="$3"
 
        local destination
        local err
@@ -29,21 +28,6 @@ test_source_tree() {
                return 1
        fi
 
-       if ! ( cd "$destination" && git checkout "$commit" ); then
-               local errmsg
-
-               errmsg="Could not check out commit $commit from $repository"
-               log_error "$errmsg"
-               echo "$errmsg"
-
-               if ! rm -rf "$destination"; then
-                       log_warn "Could not remove $destination"
-                       echo "Could not remove $destination"
-               fi
-
-               return 1
-       fi
-
        err=0
 
        if ! ( cd "$destination" && make test ) 2>&1; then
@@ -64,21 +48,15 @@ publish_result() {
        local context="$3"
        local repository="$4"
        local branch="$5"
-       local commit="$6"
-       local result="$7"
-       local testlog="$8"
+       local result="$6"
 
        local testmsg
-       local testlogs
-
-       readarray -t testlogs <<< "$testlog"
 
-       if ! testmsg=$(foundry_msg_test_new "$context"      \
-                                           "$repository"   \
-                                           "$branch"       \
-                                           "$commit"       \
-                                           "$result"       \
-                                           "${testlogs[@]}"); then
+       if ! testmsg=$(foundry_msg_test_new "$context"    \
+                                           "$repository" \
+                                           "$branch"     \
+                                           "$commit"     \
+                                           "$result"); then
                log_error "Could not make test message"
                return 1
        fi
@@ -114,10 +92,6 @@ handle_test_request() {
        elif ! branch=$(foundry_msg_testrequest_get_branch "$request"); then
                log_warn "Could not get branch from message. Dropping."
                return 1
-
-       elif ! commit=$(foundry_msg_testrequest_get_commit "$request"); then
-               log_warn "Could not get commit from message. Dropping."
-               return 1
        fi
 
        result=0
@@ -126,7 +100,7 @@ handle_test_request() {
                return 1
        fi
 
-       if ! test_source_tree "$repository" "$branch" "$commit" &> "$testlog"; then
+       if ! test_source_tree "$repository" "$branch" &> "$testlog"; then
                result=1
        fi
 
@@ -140,8 +114,8 @@ handle_test_request() {
                return 1
        fi
 
-       if ! publish_result "$endpoint" "$topic" "$context" "$repository" \
-                           "$branch" "$commit" "$result" "$testlog"; then
+       if ! publish_result "$endpoint" "$topic" "$context" \
+                           "$repository" "$branch" "$result"; then
                log_warn "Could not publish test result"
                return 1
        fi