config

package
v12.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const RegistrationWarning = "" /* 188-byte string literal not displayed */

Variables

View Source
var Example []byte

Functions

func FromRegistration added in v12.7.0

func FromRegistration(config *Config) error

func SaveRegistration

func SaveRegistration(file string, reg *Registration) error

Types

type Cache

type Cache struct {
	Enabled                 bool   // Enabled indicates whether caching is enabled.
	Dir                     string // Dir specifies the directory path for caching.
	Host                    string // Host specifies the caching host.
	Port                    uint16 // Port specifies the caching port.
	ProxyPort               uint16 // ProxyPort specifies the cache proxy port.
	ExternalServer          string // ExternalServer specifies the URL of external cache server
	ActionsCacheURLOverride string // Allows the user to override the ACTIONS_CACHE_URL passed to the workflow containers
	Secret                  string // Shared secret to secure caches.
}

Cache represents the configuration for caching.

type Config

type Config struct {
	Log       Log       // Log represents the configuration for logging.
	Runner    Runner    // Runner represents the configuration for the runner.
	Cache     Cache     // Cache represents the configuration for caching.
	Container Container // Container represents the configuration for the container.
	Host      Host      // Host represents the configuration for the host.
	Server    Server    // Server configures connections to Forgejo and their behaviour.
}

Config represents the overall configuration.

func New added in v12.7.0

func New(opts ...Option) (*Config, error)

New returns a new Config initialized with default values. Use any number of Option arguments to customize the Config after initialization.

type Connection added in v12.7.0

type Connection struct {
	URL           *url.URL      // URL of the Forgejo instance to connect to. Mandatory value.
	UUID          gouuid.UUID   // UUID of the runner. Mandatory value.
	Token         string        // Token of the runner. Mandatory value.
	Labels        labels.Labels // Labels of the runner. Mandatory value.
	FetchInterval time.Duration // FetchInterval specifies the interval duration for fetching resources.
	// contains filtered or unexported fields
}

Connection defines a connection to a Forgejo instance.

type Container

type Container struct {
	Network       string   // Network specifies the network for the container.
	EnableIPv6    bool     // EnableIPv6 indicates whether the network is created with IPv6 enabled.
	Privileged    bool     // Privileged indicates whether the container runs in privileged mode.
	Options       string   // Options specifies additional options for the container.
	WorkdirParent string   // WorkdirParent specifies the parent directory for the container's working directory.
	ValidVolumes  []string // ValidVolumes specifies the volumes (including bind mounts) can be mounted to containers.
	DockerHost    string   // DockerHost specifies the Docker host. It overrides the value specified in environment variable DOCKER_HOST.
	ForcePull     bool     // Pull docker image(s) even if already present
	ForceRebuild  bool     // Rebuild local docker image(s) even if already present
}

Container represents the configuration for the container.

type Host

type Host struct {
	WorkdirParent string // WorkdirParent specifies the parent directory for the host's working directory.
}

Host represents the configuration for the host.

type Log

type Log struct {
	Level    string // Level indicates the logging level.
	JobLevel string // JobLevel indicates the job logging level.
}

Log represents the configuration for logging.

type Option added in v12.7.0

type Option func(config *Config) error

Option for customizing Config instances after their initialization.

func FromFile added in v12.7.0

func FromFile(path string) Option

FromFile reads settings from a configuration file and applies them to an existing Config instance.

type Registration

type Registration struct {
	Warning string `json:"WARNING"` // Warning message to display, it's always the RegistrationWarning constant

	ID      int64    `json:"id"`
	UUID    string   `json:"uuid"`
	Name    string   `json:"name"`
	Token   string   `json:"token"`
	Address string   `json:"address"`
	Labels  []string `json:"labels"`
}

Registration is the registration information for a runner

func LoadRegistration

func LoadRegistration(file string) (*Registration, error)

type Retry

type Retry struct {
	MaxRetries   uint          // Maximum number of retry attempts, defaults to 10.
	InitialDelay time.Duration // Initial delay between retries, defaults to 100ms.  Delay between retries doubles up to `max_delay`.
	MaxDelay     time.Duration // Maximum delay between retries, defaults to 0, 0 is treated as no maximum.
}

Retry defines the retry behaviour of Runner when sending logs to Forgejo.

type Runner

type Runner struct {
	File            string            // File specifies the file path for the runner.
	Capacity        int               // Capacity specifies the capacity of the runner.
	Envs            map[string]string // Envs stores environment variables for the runner.
	EnvFile         string            // EnvFile specifies the path to the file containing environment variables for the runner.
	Timeout         time.Duration     // Timeout specifies the duration for runner timeout.
	ShutdownTimeout time.Duration     // ShutdownTimeout specifies the duration to wait for running jobs to complete during a shutdown of the runner.
	Insecure        bool              // Insecure indicates whether the runner operates in an insecure mode.
	FetchTimeout    time.Duration     // FetchTimeout specifies the timeout duration for fetching resources.
	ReportInterval  time.Duration     // ReportInterval specifies the interval duration for reporting status and logs of a running job.
	DefaultLabels   []string          // Default labels for a runner, if not configured at server connection.
	ReportRetry     Retry             // At the end of a job, configures retrying sending logs to remote.
}

Runner represents the configuration for the runner.

type Server added in v12.7.0

type Server struct {
	Connections map[string]*Connection // Connections defines which Forgejo instance(s) Forgejo Runner should connect to. The map's key serves as connection name.
}

Server configures connections to Forgejo and their behaviour.

Jump to

Keyboard shortcuts

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