semaphore
semaphore copied to clipboard
How to clean up task templates in Semaphore GUI
Is there way to clean up multiple Semaphore template from the GUI instead of delete one by one?
you have two options.
- go in to database and clear the task__output, task table
- 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