Cannot automate Gitea Actions runner registration - CLI generated tokens not recognized #14575

Closed
opened 2025-11-02 11:16:37 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @cmxela on GitHub (Jun 9, 2025).

Description

I'm trying to automate the deployment of Gitea Actions runners in a Kubernetes environment, but I'm encountering an issue where tokens generated via the CLI command are not recognized by the runner.

Current Behavior

  1. Running gitea actions generate-runner-token successfully generates a token
  2. When the act_runner tries to use this token, it fails with: runner registration token not found
  3. The documentation states that registration tokens should be obtained from the web UI at /admin/actions/runners

Expected Behavior

The CLI-generated token should work for runner registration, enabling fully automated deployments without manual web UI interaction.

Steps to Reproduce

  1. Deploy Gitea 1.22.3 with Actions enabled:
[actions]
ENABLED = true
DEFAULT_ACTIONS_URL = https://gitea.com
  1. Generate a runner token via CLI:
gitea --config /data/gitea/conf/app.ini actions generate-runner-token
  1. Try to register a runner with the generated token:
act_runner register --no-interactive --instance https://git.example.com --token <generated-token> --name runner-1
  1. Runner fails with: runner registration token not found

Environment

  • Gitea Version: 1.22.3
  • act_runner Version: 0.2.11
  • Deployment: Kubernetes (MicroK8s)
  • OS: Ubuntu 24.04

Use Case

This is blocking automated CI/CD deployments where runners need to be provisioned without manual intervention. In Kubernetes environments, it's common to deploy all components via manifests/operators without requiring manual web UI steps.

Possible Solutions

  1. Make CLI-generated tokens work with runner registration
  2. Add an API endpoint to retrieve registration tokens (similar to #23761 but for instance-level runners)
  3. Document how to retrieve the registration token programmatically for automation scenarios
  • #23761 (Added API for repo-level runner tokens, but not for instance-level)
  • #26370 (Gitea Actions REST API proposal)
Originally created by @cmxela on GitHub (Jun 9, 2025). ### Description I'm trying to automate the deployment of Gitea Actions runners in a Kubernetes environment, but I'm encountering an issue where tokens generated via the CLI command are not recognized by the runner. ### Current Behavior 1. Running `gitea actions generate-runner-token` successfully generates a token 2. When the act_runner tries to use this token, it fails with: `runner registration token not found` 3. The documentation states that registration tokens should be obtained from the web UI at `/admin/actions/runners` ### Expected Behavior The CLI-generated token should work for runner registration, enabling fully automated deployments without manual web UI interaction. ### Steps to Reproduce 1. Deploy Gitea 1.22.3 with Actions enabled: ```ini [actions] ENABLED = true DEFAULT_ACTIONS_URL = https://gitea.com ``` 2. Generate a runner token via CLI: ```bash gitea --config /data/gitea/conf/app.ini actions generate-runner-token ``` 3. Try to register a runner with the generated token: ```bash act_runner register --no-interactive --instance https://git.example.com --token <generated-token> --name runner-1 ``` 4. Runner fails with: `runner registration token not found` ### Environment - Gitea Version: 1.22.3 - act_runner Version: 0.2.11 - Deployment: Kubernetes (MicroK8s) - OS: Ubuntu 24.04 ### Use Case This is blocking automated CI/CD deployments where runners need to be provisioned without manual intervention. In Kubernetes environments, it's common to deploy all components via manifests/operators without requiring manual web UI steps. ### Possible Solutions 1. Make CLI-generated tokens work with runner registration 2. Add an API endpoint to retrieve registration tokens (similar to #23761 but for instance-level runners) 3. Document how to retrieve the registration token programmatically for automation scenarios ### Related Issues - #23761 (Added API for repo-level runner tokens, but not for instance-level) - #26370 (Gitea Actions REST API proposal)
GiteaMirror added the topic/gitea-actionsissue/needs-feedback labels 2025-11-02 11:16:37 -06:00
Author
Owner

@ChristopherHX commented on GitHub (Jun 10, 2025):

I was able to use actions generate-runner-token in an automated setup script in Gitea 1.24 in about 90% of setups, in the other 10% the cli tool returned an error instead of a token that might needs automated retries to eliminate.

Possible Solutions

  • Upgrade to Gitea 1.23

2. Add an API endpoint to retrieve registration tokens (similar to Add API endpoint to get token for registering runners for repos #23761 but for instance-level runners)

Exists in 1.23 (GET /admin/runners/registration-token) and 1.24 (POST /admin/actions/runners/registration-token)

See also https://gitea.com/api/swagger#/admin/adminCreateRunnerRegistrationToken (Gitea.com may expose apis that are only part of Gitea nightly, so use your own instance swagger to be sure)

No I didn't target Gitea 1.22 in my independent automation tests, since this is way too old

@ChristopherHX commented on GitHub (Jun 10, 2025): I was able to use `actions generate-runner-token` in an automated setup script in Gitea 1.24 in about 90% of setups, in the other 10% the cli tool returned an error instead of a token that might needs automated retries to eliminate. ### Possible Solutions - Upgrade to Gitea 1.23 > 2\. Add an API endpoint to retrieve registration tokens (similar to [Add API endpoint to get token for registering runners for repos #23761](https://github.com/go-gitea/gitea/pull/23761) but for instance-level runners) Exists in 1.23 (GET `/admin/runners/registration-token`) and 1.24 (POST `/admin/actions/runners/registration-token`) See also <https://gitea.com/api/swagger#/admin/adminCreateRunnerRegistrationToken> (Gitea.com may expose apis that are only part of Gitea nightly, so use your own instance swagger to be sure) _No I didn't target Gitea 1.22 in my independent automation tests, since this is way too old_
Author
Owner

@wxiaoguang commented on GitHub (Jun 10, 2025):

Please upgrade to 1.24 and try again. 1.22 is an outdated & unsupported version

@wxiaoguang commented on GitHub (Jun 10, 2025): Please upgrade to 1.24 and try again. 1.22 is an outdated & unsupported version
Author
Owner

@cmxela commented on GitHub (Jun 10, 2025):

Thanks, upgrading worked

@cmxela commented on GitHub (Jun 10, 2025): Thanks, upgrading worked
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14575