API to remove runners #14202

Open
opened 2025-11-02 11:06:12 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @honx on GitHub (Feb 28, 2025).

Feature Description

I'm running a gitea installation with a lot of "ephemeral" act_runners. These register, do work for a short amount of time and then get deleted. It seems there is currently no way to programmatically remove runners from repos/orgs and it has to be done by hand in the web ui.

The following functions would be really useful for me:
a) a way to retrieve runner info (esp. Status and "Last online Time") via the REST API
b) a way to delete runners via the REST API
c) a way for a runner to deregister itself via the grpc API (not a replacement for a) since the runner cannot be trusted to deregister itself)

I had look through the Rest API, grpc api and there currently (1.24 dev) doesnt seem to be a way to do this. I also didnt find any issues for gitea or act_runner that already discuss this.

Screenshots

No response

Originally created by @honx on GitHub (Feb 28, 2025). ### Feature Description I'm running a gitea installation with a lot of "ephemeral" act_runners. These register, do work for a short amount of time and then get deleted. It seems there is currently no way to programmatically remove runners from repos/orgs and it has to be done by hand in the web ui. The following functions would be really useful for me: a) a way to retrieve runner info (esp. Status and "Last online Time") via the REST API b) a way to delete runners via the REST API c) a way for a runner to deregister itself via the grpc API (not a replacement for a) since the runner cannot be trusted to deregister itself) I had look through the Rest API, grpc api and there currently (1.24 dev) doesnt seem to be a way to do this. I also didnt find any issues for gitea or act_runner that already discuss this. ### Screenshots _No response_
GiteaMirror added the topic/gitea-actionstopic/apitype/proposal labels 2025-11-02 11:06:12 -06:00
Author
Owner

@ChristopherHX commented on GitHub (Feb 28, 2025):

I came around an ephemeral runner management application that actually used the runners rest api of GitHub Actions just this week. Mounting this into Gitea Rest would be great, otherwise the runner list cleanup logic fails.

Those apis I would suggest are based on GitHubs like

A marker for myself
ae4a3d7708/routers/web/shared/actions/runners.go (L296)

I wanted to have c) as fallback of missing server support for ephemeral WIP, but now it's to late for my usecase as no ephemeral support most likely implies no self remove.

@ChristopherHX commented on GitHub (Feb 28, 2025): I came around an ephemeral runner management [application](https://github.com/go-gitea/gitea/issues/32461#issuecomment-2644855377) that actually used the runners rest api of GitHub Actions just this week. Mounting this into Gitea Rest would be great, otherwise the runner list cleanup logic fails. Those apis I would suggest are based on GitHubs like - List https://docs.github.com/de/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-organization - Delete https://docs.github.com/de/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-an-organization A marker for myself https://github.com/go-gitea/gitea/blob/ae4a3d770813f37f092bdea8a2b3a0827fcc1b41/routers/web/shared/actions/runners.go#L296 I wanted to have c) as fallback of missing server support for [ephemeral WIP](https://github.com/go-gitea/gitea/issues/32461), but now it's to late for my usecase as no ephemeral support most likely implies no self remove.
Author
Owner

@ChristopherHX commented on GitHub (Mar 2, 2025):

For what it worth here a draft of an organization + repository level implementation of 1) and 2) fe4f407e66 + 624fde6a4c (to fix the labels getter)

This area is currently in flux, while my other changes are pending.

@ChristopherHX commented on GitHub (Mar 2, 2025): For what it worth here a draft of an organization + repository level implementation of 1) and 2) https://github.com/ChristopherHX/gitea/commit/fe4f407e66e9f924de5fcf7eac6cf70a8a3a2bc7 + https://github.com/ChristopherHX/gitea/commit/624fde6a4cf42a929f5da052216b782824d96afe (to fix the labels getter) This area is currently in flux, while my other changes are pending.
Author
Owner

@honx commented on GitHub (Mar 11, 2025):

@ChristopherHX Thanks for the feedback! So this means you're already working on that? I may actually also put some work into this. But I cannot really say if i find the time so this can still make it into 1.24...

@honx commented on GitHub (Mar 11, 2025): @ChristopherHX Thanks for the feedback! So this means you're already working on that? I may actually also put some work into this. But I cannot really say if i find the time so this can still make it into 1.24...
Author
Owner

@ChristopherHX commented on GitHub (Mar 11, 2025):

So this means you're already working on that?

Yes for 1) and 2) I did start, but open points are

  • swagger documentation
  • reject deleting active runners (the webui does not check anything)
  • Ephemeral json field depends on an active PR
    • Either hardcode it to false as long it is missing
    • or wait for it be reviewed before creating a PR
  • write tests

I would leave point 3) open, because there are much more repositories involved in changing the grpc API. (I did go through this process recently for ephemeral, that is still pending)

If you want to give 3) a go feel free to look into it.

@ChristopherHX commented on GitHub (Mar 11, 2025): > So this means you're already working on that? Yes for 1) and 2) I did start, but open points are - [x] swagger documentation - [x] reject deleting active runners (the webui does not check anything) - [x] Ephemeral json field depends on an active PR - Either hardcode it to false as long it is missing - or wait for it be reviewed before creating a PR - [x] write tests I would leave point 3) open, because there are much more repositories involved in changing the grpc API. (I did go through this process recently for ephemeral, that is still pending) If you want to give 3) a go feel free to look into it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14202