Skip to content

Instantly share code, notes, and snippets.

View matsskoglund's full-sized avatar

Mats Skoglund matsskoglund

View GitHub Profile
@matsskoglund
matsskoglund / remove-runners.sh
Created June 21, 2018 09:16
Remove all Gitlab runners for a user and group
#!/bin/bash
PAMTOKEN=YoUrPaMtOkEn
USERNAME=username
GROUPNAME=groupname
echo Disable all runners for a user
curl -s --request GET --header "PRIVATE-TOKEN: $PAMTOKEN" "https://gitlab.com/api/v4/users/$USERNAME/projects"|jq '.[].id'|while read -r line1; do command curl -s --header "PRIVATE-TOKEN: $PAMTOKEN" "https://gitlab.com/api/v4/projects/$line1/runners"|jq '.[].id'|while read -r line; do command curl --request DELETE --header "PRIVATE-TOKEN: $PAMTOKEN" "https://gitlab.com/api/v4/projects/$line1/runners/$line"; done;done
echo Disable all runners for a group