From cf52ed0cebf935fc4d6012666e8fb2bd1908a5cf Mon Sep 17 00:00:00 2001
From: Jason Hiser <jdhiser@gmail.com>
Date: Wed, 18 Sep 2019 09:33:47 -0400
Subject: [PATCH] when fuzzing fail, assign issue to person who started the job

---
 cicd_testing/do-fuzz.sh | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/cicd_testing/do-fuzz.sh b/cicd_testing/do-fuzz.sh
index 0398422..3bd94c6 100755
--- a/cicd_testing/do-fuzz.sh
+++ b/cicd_testing/do-fuzz.sh
@@ -33,14 +33,12 @@ function main()
 	echo "The report is: "
 	echo "$report" | tee fail_report.yaml
 
-
 	local declare crash_count=$(echo "$report"|shyaml get-value failing-input-count)
 
 	if [[ $crash_count == 0 ]]; then
 		echo "No crashes found"
 		exit 0
 	else
-		set -x 
 		# upload the report.
 		local proj_id=114
 		local upload_report=$(curl --request POST --header "PRIVATE-TOKEN: PXLgVFpgjmmugAiHTJzx " --form "file=@fail_report.yaml" https://git.zephyr-software.com/api/v4/projects/$proj_id/uploads)
@@ -49,8 +47,7 @@ function main()
 		local host=$(hostname)
 		local md=$(echo $upload_report | shyaml get-value markdown)
 		local desc=""
-		set +e # allow read to return non-zero as read does that on EOF
-		read -r -d '' desc << EOM
+		read -r -d '' desc || true << EOM
 Turbo automatically found $crash_count crashes!
 
 Host: $host
@@ -65,12 +62,11 @@ See [job details](https://git.zephyr-software.com/opensrc/libehp/-/jobs/$CI_JOB_
 and [pipeline details](https://git.zephyr-software.com/opensrc/libehp/pipelines/$CI_PIPELINE_ID).
 
 EOM
-		set -e
 		local title="Turbo found $crash_count bugs in libEHP on $date"
-
+		local assignee_id="$GITLAB_USER_ID"
 
 		# finally post an issue
-		curl --request POST --data-urlencode "description=$desc" --data-urlencode "title=$title" --header "PRIVATE-TOKEN: PXLgVFpgjmmugAiHTJzx " "https://git.zephyr-software.com//api/v4/projects/$proj_id/issues?&labels=bug,turbo&assignee_ids[]=3"
+		curl --request POST --data-urlencode "description=$desc" --data-urlencode "title=$title" --header "PRIVATE-TOKEN: PXLgVFpgjmmugAiHTJzx " "https://git.zephyr-software.com//api/v4/projects/$proj_id/issues?&labels=bug,turbo&assignee_ids[]=$assignee_id"
 
 		echo "$crash_count count crashes found!"
 		exit 1
-- 
GitLab