Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. JENKINS_URL=$1
  4. HINT=${2-master}
  5. USER=${3-jenkins}
  6. JENKINS_TOKEN=$4
  7. REMINDER=`mktemp /tmp/${HINT}.XXXXX`
  8.  
  9. echo "ID's will be printed on ${REMINDER}"
  10.  
  11. curl ${JENKINS_URL}/queue/api/json --user $USER:$JENKINS_TOKEN | \
  12. jq '.items[] | " \(.id) \(.task.name)"' | \
  13. grep $HINT | \
  14. cut -f2 -d' ' > $REMINDER
  15.  
  16. while read JID; do
  17. echo "Cancel $JID"
  18. curl -X POST ${JENKINS_URL}/queue/cancelItem\?id\=$JID --user $USER:$JENKINS_TOKEN
  19. done < $REMINDER
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement