mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-22 06:24:14 -05:00
Register act_runner as ephemeral to Gitea #13692
Closed
opened 2025-11-02 10:50:31 -06:00 by GiteaMirror
·
12 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16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0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#13692
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ChristopherHX on GitHub (Nov 9, 2024).
Originally assigned to: @ChristopherHX on GitHub.
Feature Description
My idea is to
This proposal would allow to securely deploy a registred host-mode act_runner in a VM and reset the same after job exit.
Some of my idea has been scetched in https://github.com/ChristopherHX/gitea/tree/ephemeral-runners.
Protocol proposal here: https://gitea.com/gitea/actions-proto-def/pulls/14
Read more here: https://gitea.com/gitea/act_runner/issues/19#issuecomment-932880
Screenshots
No response
@wolfogre commented on GitHub (Nov 11, 2024):
I have a wait-and-see attitude towards this proposal.
Regarding running safely in host mode, my first instinct is:
To clarify, in the current design, Gitea does not actively assign tasks to runners; it only attempts to assign a new task when a runner requests one (if available). The purpose of this design is to allow the runner to decide for itself whether it is ready to receive more tasks, while Gitea only determines if there are new tasks to assign.
@ChristopherHX commented on GitHub (Nov 11, 2024):
This matches with the new run once mode that has been recently merged: https://gitea.com/gitea/act_runner/pulls/598
Anyone can fetch new jobs with the current runner state files, that could be uploaded to a bad actors server when the runner is in host-mode.
The same applies to GitHub Actions as long they are not ephemeral.
My proposal would optionally invalidate the token like in GitHub Actions.
Making FetchTask always fail after a job has been fetched is another idea that depends on once mode of the runner.
@wolfogre commented on GitHub (Nov 11, 2024):
It cannot be a reason that "#598 has been merged so we should keep going that way." I just want to discuss whether we have a better design to handle this.
@ChristopherHX commented on GitHub (Nov 11, 2024):
Yes let's discuss, this is still a pure proposal except the hardening change.
I only wanted to clairify the problems of the approuch you have described and that it looks based on my opinion like the once flag.
In GitHub Actions there is an alternative way as well for long lived runner state files
Adding more native act runtimes, seems to be a mess.
@ChristopherHX commented on GitHub (Nov 24, 2024):
This proposal aims to implement https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/autoscaling-with-self-hosted-runners#using-ephemeral-runners-for-autoscaling.
While I agree that gitea doesn't assign jobs to a specfic runner, but I still want the stronger security you get by this feature of GitHub Actions also in Gitea.
Once my main post would get 10 upvotes or more I create a Pull Request (eventually a ping/message in this issue is required) until then I wait for alternative proposals that bring similar security to act_runner in host mode.
I will create another proposal for uploading logs and job state via the ACTIONS_RUNTIME_TOKEN so an act_runner can act as auto scaler for single job act_runners.
@KhaineBOT commented on GitHub (Jan 28, 2025):
The challenge is how to manage the ephemeral runners. If you need to spin up, register, run the act, and then tear it down. Either, you need a third party piece of software to do this orchestration or it gets built into gitea. I think what would make sense to define a lightweight orchestration protocol. Third parties could use this to create complex orchestrations (i.e. running across many disparate hosts/platforms.) and gitea could implement simple orchestration on the local host. For many users, a simple host/docker only orchestration solution built into gitea would be highly beneficial.
We should make it as easy as possible for ephemeral runners to be used. Ideally, they should be the preferred method given the risks posed by long running acts.
@gabriel-samfira commented on GitHub (Feb 8, 2025):
I am willing to add support for gitea in GARM if it comes somewhat close to how ephemeral runners and webhooks work in github. I could then abstract away the code forge part of GARM and create an implementation for gitea. That would help with the ephemeral runner management part. And it would unlock the plethora of IaaS providers that GARM offers, for gitea as well.
Edit: someone already opened a request for this feature here: https://github.com/cloudbase/garm/issues/323
@ChristopherHX commented on GitHub (Feb 8, 2025):
From your referenced request, it might make sense that you would create a proposal additionally for the following item, which is 0% covered right now and reference this proposal
this proposal seem to hit 10 upvotes, so I will look into making a Pull Request for the ephemeral runner part soon
@ChristopherHX commented on GitHub (Feb 23, 2025):
workflow_job webhook experimental https://github.com/go-gitea/gitea/pull/33694 as independent feature
Can be cherry picked on top of ephemeral runners PR to be tested together.
I'm using this branch with both changes to test things locally: https://github.com/ChristopherHX/gitea/tree/workflow_job_webhook, beware this contains Database Migration that are not part of nightly backups are important.
@cobak78 commented on GitHub (Mar 12, 2025):
I think this issue https://codeberg.org/forgejo/discussions/issues/241 is slightly related and explores another solution on this topic by moving the poller to an external scaler.
@ChristopherHX commented on GitHub (Mar 19, 2025):
Hello @cobak78,
I skimmed over your discussion, while I'm planning to only implement the workflow_run + workflow_job endpoints defined by GitHub in Gitea instead of brewing our own like you seem to have done for Forgejo. This means for example using github_runner scaler of keda instead of creating a Gitea specific one, my initial test seems to show the queue metric can be calculated from my POC branch without webhooks or code changes to keda.
If you trust everyone who gains access to queue Jobs on your Forgejo instance, please ignore the rest of my post.
I would suggest that you audit the security of your Forgejo runner long living credentials when using labels with
:host, since only the:docker://labels can protect the credential file, without using the feature discussed here, based on my knowledge from the Gitea runner and nektos/act.My goal of ephemeral runners in Gitea is, even if the long living runner credentials are exposed to a non trusted job that they become invalid for accessing additional write tokens + secets by fetching additional tasks that everybody can do with read access to the runner credential file (you make use of the reusability of this file content as a feature).
I saw inside your gist an kubernetes internal dns name for the runner creds to Forgejo, this means for exploiting this outside of kubernetes you need to know the public endpoint of gitea if this is not already leaked inside the job in
GITHUB_SERVER_URL, but afaik the original registration domain is not recorded on the server to block access.For a private or proof of concept instance your approach is perfectly fine 👍 .
@cobak78 commented on GitHub (Jun 5, 2025):
Hi @ChristopherHX ,
thanks for your comment. As you say, and also the documentation on forgejo on the self-host runner type, there is no boundary limit on that type.
I will add a disclaimer explaining this potential missue.
In my own solution i only offer runner with docker type labels, so it's not really a problem