This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |