gitea

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gitea implements providers.Provider for Gitea Actions.

Gitea Actions uses the same workflow syntax as GitHub Actions but runs jobs via act_runner, which embeds nektos/act and talks to the Gitea instance over ConnectRPC (Register, Declare, FetchTask, UpdateTask, UpdateLog).

Integration model (embed binary):

ephemerd polls for tasks via the ConnectRPC FetchTask endpoint.
When a job arrives, ephemerd spins up a container from the default
runner image (which has act_runner pre-installed) and launches:

  act_runner daemon --ephemeral

with the runner config pre-seeded (instance URL, token, labels).
The runner handles workflow execution, log streaming, and status
reporting. ephemerd manages the container lifecycle.

Gitea vs Forgejo:

While the protocol is nearly identical (both ConnectRPC, same 5 RPCs),
the proto packages and runner binaries have diverged:
  - Gitea:   act_runner       / code.gitea.io/actions-proto-go
  - Forgejo: forgejo-runner   / code.forgejo.org/forgejo/actions-proto
  - Gitea uses --ephemeral flag; Forgejo uses dedicated one-job command

Reference:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// InstanceURL is the base URL of the Gitea instance (e.g., "https://gitea.example.com").
	InstanceURL string

	// Token is the runner registration token from the Gitea admin panel.
	// Found at: Site Administration > Actions > Runners > Create new runner.
	Token string

	// Owner is the organization or user that owns the runner.
	// If empty, the runner is registered at the instance level.
	Owner string

	// Repos limits the runner to specific repositories.
	// If empty, the runner accepts jobs from all repos the owner has access to.
	Repos []string

	// Labels are the runner labels to register with the forge.
	// Each label is a string like "ubuntu-latest:docker://image:tag".
	// If empty, defaults to ["ubuntu-latest:docker://<job_image>"].
	Labels []string

	// DefaultImage is the legacy single-image override for the runner
	// daemon container (Linux). Prefer LinuxImage / WindowsImage.
	// Default: "docker.io/gitea/act_runner:latest"
	DefaultImage string

	// LinuxImage / WindowsImage override the runner daemon image per job OS.
	LinuxImage   string
	WindowsImage string

	// JobImage is the default OCI image for job execution containers.
	// The runner daemon creates job containers via the fake Docker socket;
	// this image is what those containers run.
	// Default: "docker.io/gitea/runner-images:ubuntu-24.04"
	JobImage string

	// HTTPClient is an optional *http.Client for the ConnectRPC client.
	// If nil, a default client with 30s timeout is used.
	HTTPClient *http.Client

	Log *slog.Logger
}

Config for the Gitea provider.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements providers.Provider for Gitea Actions.

func New

func New(cfg Config) (*Provider, error)

New creates a Gitea provider.

func (*Provider) ClaimJob

func (p *Provider) ClaimJob(ctx context.Context, event *providers.JobEvent, runnerName string, labels []string) (*providers.Claim, error)

func (*Provider) DefaultImage

func (p *Provider) DefaultImage() string

func (*Provider) DefaultImageFor

func (p *Provider) DefaultImageFor(os string) string

DefaultImageFor returns the runner-daemon image for the given job OS. Gitea's act_runner is Linux-only upstream; Windows override is honored for callers that ship a custom build.

func (*Provider) DefaultJobImage

func (p *Provider) DefaultJobImage() string

func (*Provider) FetchJobImage

func (p *Provider) FetchJobImage(ctx context.Context, event *providers.JobEvent) string

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) ReleaseJob

func (p *Provider) ReleaseJob(ctx context.Context, claim *providers.Claim) error

func (*Provider) Start

func (p *Provider) Start(ctx context.Context, cfg providers.PollConfig) (<-chan providers.JobEvent, error)

func (*Provider) Stop

func (p *Provider) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL