semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

How to clean up task templates in Semaphore GUI

Open tonyyu85 opened this issue 3 years ago • 1 comments

Is there way to clean up multiple Semaphore template from the GUI instead of delete one by one?

tonyyu85 avatar Apr 12 '22 15:04 tonyyu85

you have two options.

  1. go in to database and clear the task__output, task table
  2. via API

Example - Snippet:

declare -A taskManage
data=$(curl -k -s -G -H "Authorization: Bearer ${authToken}" 'Content-Type: application/json' -H 'Accept: application/json' ${http}://${HOST}/api/project/${projectID}/tasks) ||exit $?
taskManage[tasks]=$(jq -r -e '.[].id' <<< "${data}") || exit $?


for i in `echo ${taskManage[tasks]} | tr " " "\n"`;do
    echo -e "clean taskID: $i"
    curl -k -s -XDELETE -H "Authorization: Bearer ${authToken}" -H 'Content-Type: application/json' -H 'Accept: application/json' ${http}://${HOST}/api/project/${projectID}/tasks/$i || exit $?
done

wdsff1 avatar May 07 '22 15:05 wdsff1