mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 02:24:21 -05:00
Improve Config Management/Stateless Runner Deploy Workflows #10513
Closed
opened 2025-11-02 09:09:54 -06:00 by GiteaMirror
·
21 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.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
v1.4.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#10513
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 @benyanke on GitHub (Mar 25, 2023).
Feature Description
Currently, it seems to register a runner, you must fetch a one-time use token.
This is good, when deploying manually. This is not helpful, however, if you're trying to do things like deploy runners with config management or especially a set of runners in an auto scaling group.
I would like an option to allow either 1) reusable registration tokens or 2) some other way to be able to register multiple runners without admin interaction easily.
Screenshots
No response
@techknowlogick commented on GitHub (Mar 26, 2023):
related: https://github.com/go-gitea/gitea/issues/23643
@lunny commented on GitHub (Mar 26, 2023):
tokens should be reused, I think maybe we can change the current logic.
@cthu1hoo commented on GitHub (Mar 27, 2023):
I too ran into this problem while writing my ansible role for runner deployment, reusable tokens (similar to the way gitlab does it) sound like the best approach to me.
@benyanke commented on GitHub (Mar 27, 2023):
Exactly where I ran into it as well - writing an idiomatic ansible role was almost impossible as-is.
@garymoon commented on GitHub (May 22, 2023):
Woodpecker and Drone accept a symmetic secret via environment variables for both the application and the runners, making automated provisioning zero-touch. Could such a flow be considered for Gitea?
@sebthom commented on GitHub (May 30, 2023):
I don't really understand why a separate token mechanism was implemented for runner registration in the first place. I would suggest to remove it and instead introduce a new scope into the gitea access tokens that allows registering runners, e.g.
admin:register_runnerorregister:runner? This reusable token could then be feed into the act_runner for self-registration. Nice side effect, the token management UI is already there. You see when the token was last used and can easily revoke it.@sillyguodong commented on GitHub (May 31, 2023):
If you only use PAT to register runners, how do Gitea know the scope level (org, repo, global) of the runners.
@sebthom commented on GitHub (May 31, 2023):
@sillyguodong True, then maybe the Gitea token can be extended to be "fine grained". https://github.blog/2022-10-18-introducing-fine-grained-personal-access-tokens-for-github/ instead of adding/maintaining a parallel token infrastructure only for the purpose of runner registration tokens.
@nodiscc commented on GitHub (Oct 19, 2023):
This role can deploy act-runner and register it automatically on a gitea instance. In particular have a look at the registration part [1].
@jtran commented on GitHub (Feb 16, 2024):
Wasn't this done in https://github.com/go-gitea/gitea/pull/24767?
@lunny commented on GitHub (Mar 27, 2024):
I think this has been resolved by #23762 and #27143
@KyleGalvin commented on GitHub (Apr 4, 2024):
How does this solve the issue in a containerized environment, where we usually just have a single docker command/entrypoint?
It would be really nice to have exactly what @garymoon suggests: inject the secret at startup from the environment. That way the deployment can give both gitea and the runner the same shared key and they can authenticate automatically after that.
No command line. No side channel communication. No post-deploy setup. Just give both the key.
@KyleGalvin commented on GitHub (Jun 20, 2024):
I was searching for a solution to this, and found myself landing on this same thread 2 months down the line.
I have hacks and workarounds for the time being, but I want to describe my use-case to demonstrate how a shared environment variable between gitea and runners for initial setup can help:
I'm building a helm chart that includes gitea and act runners, and I want to automate the setup between the two.
I believe I could make a sidecar job that connects them using the API, but frankly this approach is more convoluted than I think it should be, and I'm using the following workaround hoping that a better solution comes down the pipeline.
Currently, I install the chart with an empty environment variable for the runner token.
I then wait for gitea to install and generate its own runner token. At this point, the runners are failing due to no valid token.
I go into the UI and copy that token out, pasting it into my chart values.yaml
I then update my helm chart with the new values, at which point the runners stop thrashing and connect.
This process isnt overly complicated for someone who knows how the setup works under the hood, but it would not be easy to point to my helm chart and tell another dev how to setup my environment.
@AlexMikhalev commented on GitHub (Dec 17, 2024):
Since it's the second time I've hit the same issue with Gitea and it's a show-stopper for using it, I found that fork of gitea supports setting up runners via shared secrets of the box:
https://forgejo.org/docs/latest/admin/runner-installation/#offline-registration
Example of docker compose: https://code.forgejo.org/forgejo/runner/src/branch/main/examples/docker-compose/README.md
Example of Kubernetes: https://code.forgejo.org/forgejo/runner/src/branch/main/examples/kubernetes
@lunny commented on GitHub (Dec 17, 2024):
I think this issue has been resolved by
You can find these examples in Gitea's act_runner repository.
https://gitea.com/gitea/act_runner/src/branch/main/examples
All of these features in the fork are copied from this repository except the shared secrets feature.
@lunny commented on GitHub (Dec 17, 2024):
I propose adding an additional parameter to both the Gitea CLI command and the Gitea API for registering runners. This enhancement would allow users to seamlessly configure predefined secrets for deployment on both the Gitea server and the runner sides.
By reusing the existing command-line tools and API endpoints, we can maintain consistency while extending functionality, ensuring a streamlined and efficient process for managing secrets.
@lunny commented on GitHub (Dec 17, 2024):
I created the pull request #32878 and will add some tests and docs. Please help to review.
@AlexMikhalev commented on GitHub (Dec 17, 2024):
Thank you. How can I test it?
@wxiaoguang commented on GitHub (Dec 22, 2024):
The proper fix could be like this: Use env GITEA_RUNNER_REGISTRATION_TOKEN as global runner token #32946
Now, we could just set
GITEA_RUNNER_REGISTRATION_TOKENorGITEA_RUNNER_REGISTRATION_TOKEN_FILE(the same as runner) to make Gitea server pre-init the runner token. Then everything should work out-of-box.(I think we will have in 1.23 stable)
@wxiaoguang commented on GitHub (Dec 22, 2024):
I think we could review and merge the fix into 1.23 and then you could try it with 1.23 nightly (maybe in one day)
@AlexMikhalev commented on GitHub (Dec 23, 2024):
Thank you!.
On Mon, Dec 23, 2024, at 09:59, wxiaoguang wrote: