Skip to content

Add API ability to disabled shared runners

Add the option the API to disable shared runners for a project.


Original description:

The use case

I want to disable shared runners for all 172 projects in my group gitlab.com/urelay/

there is no way to do it on a group level. There is a ticket for that https://gitlab.com/gitlab-org/gitlab-ce/issues/48870

So I opted to do a for each project disable runners that are "is_shared": true

I just tried everything in the API manual

the API docs claim that I can list runners for a project like this

https://gitlab.com/api/v4/projects/12585721/runners

this works. I do get ....

{
       "id": 380986,
       "description": "shared-runners-manager-5.gitlab.com",
       "ip_address": "35.207.49.66",
       "active": true,
       "is_shared": true,
       "name": "gitlab-runner",
       "online": true,
       "status": "online"
   },
   {
       "id": 380987,
       "description": "shared-runners-manager-6.gitlab.com",
       "ip_address": "35.207.54.55",
       "active": true,
       "is_shared": true,
       "name": "gitlab-runner",
       "online": true,
       "status": "online"
   },

....

but when I try to disable a runner for a project like here

https://docs.gitlab.com/ee/api/runners.html#disable-a-runner-from-project

DELETE https://gitlab.com/api/v4/projects/:id/runners/:runner_id

DELETE https://gitlab.com/api/v4/projects/12585721/runners/380987

I get

{
    "message": "404 Runner Not Found"
}
Edited by Cynthia "Arty" Ng