Documentation
¶
Overview ¶
Package runner provides types for GitLab Runner config.toml configuration. These types allow you to programmatically generate runner configurations with typed safety and TOML serialization.
Index ¶
- Constants
- type CacheAzureConfig
- type CacheConfig
- type CacheGCSConfig
- type CacheS3Config
- type Config
- type CustomConfig
- type DockerConfig
- type DockerService
- type KubernetesConfig
- type KubernetesConfigMap
- type KubernetesDNSConfig
- type KubernetesDNSConfigOption
- type KubernetesEmptyDir
- type KubernetesHostPath
- type KubernetesPVC
- type KubernetesPodSecurityContext
- type KubernetesSecret
- type KubernetesService
- type KubernetesVolumes
- type MachineConfig
- type Runner
- type SessionServer
Constants ¶
const ( ExecutorShell = "shell" ExecutorDocker = "docker" ExecutorDockerMachine = "docker+machine" ExecutorKubernetes = "kubernetes" ExecutorCustom = "custom" ExecutorSSH = "ssh" ExecutorParallels = "parallels" ExecutorVirtualBox = "virtualbox" ExecutorDockerSSH = "docker-ssh" )
Executor constants for runner executor types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheAzureConfig ¶
type CacheAzureConfig struct {
// AccountName for Azure storage
AccountName string `toml:"AccountName,omitempty"`
// AccountKey for Azure storage
AccountKey string `toml:"AccountKey,omitempty"`
// ContainerName for cache
ContainerName string `toml:"ContainerName,omitempty"`
// StorageDomain override
StorageDomain string `toml:"StorageDomain,omitempty"`
}
CacheAzureConfig holds Azure Blob cache configuration.
type CacheConfig ¶
type CacheConfig struct {
// Type of cache (s3, gcs, azure)
Type string `toml:"Type,omitempty"`
// Path prefix for cache objects
Path string `toml:"Path,omitempty"`
Shared bool `toml:"Shared,omitempty"`
// S3 configuration
S3 *CacheS3Config `toml:"s3,omitempty"`
// GCS configuration
GCS *CacheGCSConfig `toml:"gcs,omitempty"`
// Azure configuration
Azure *CacheAzureConfig `toml:"azure,omitempty"`
}
CacheConfig holds cache configuration.
type CacheGCSConfig ¶
type CacheGCSConfig struct {
// CredentialsFile path
CredentialsFile string `toml:"CredentialsFile,omitempty"`
// AccessID for HMAC auth
AccessID string `toml:"AccessID,omitempty"`
// PrivateKey for HMAC auth
PrivateKey string `toml:"PrivateKey,omitempty"`
// BucketName for cache
BucketName string `toml:"BucketName,omitempty"`
}
CacheGCSConfig holds GCS cache configuration.
type CacheS3Config ¶
type CacheS3Config struct {
// ServerAddress of S3 server
ServerAddress string `toml:"ServerAddress,omitempty"`
// AccessKey for S3
AccessKey string `toml:"AccessKey,omitempty"`
// SecretKey for S3
SecretKey string `toml:"SecretKey,omitempty"`
// BucketName for cache
BucketName string `toml:"BucketName,omitempty"`
// BucketLocation/region
BucketLocation string `toml:"BucketLocation,omitempty"`
// Insecure skips TLS verification
Insecure bool `toml:"Insecure,omitempty"`
// AuthenticationType (access-key, iam)
AuthenticationType string `toml:"AuthenticationType,omitempty"`
}
CacheS3Config holds S3 cache configuration.
type Config ¶
type Config struct {
// Concurrent limits how many jobs globally can be run concurrently
Concurrent int `toml:"concurrent,omitempty"`
// CheckInterval is the interval in seconds between job check requests
CheckInterval int `toml:"check_interval,omitempty"`
// LogLevel specifies the log level (debug, info, warn, error, fatal, panic)
LogLevel string `toml:"log_level,omitempty"`
// LogFormat specifies the log format (runner, text, json)
LogFormat string `toml:"log_format,omitempty"`
// SentryDSN for error reporting
SentryDSN string `toml:"sentry_dsn,omitempty"`
// ListenAddress for metrics/debug server
ListenAddress string `toml:"listen_address,omitempty"`
// Session server configuration
Session *SessionServer `toml:"session_server,omitempty"`
// Runners is the list of runner configurations
Runners []Runner `toml:"runners,omitempty"`
}
Config represents the top-level GitLab Runner config.toml structure.
type CustomConfig ¶
type CustomConfig struct {
// ConfigExec path to configuration executable
ConfigExec string `toml:"config_exec,omitempty"`
// ConfigArgs for configuration
ConfigArgs []string `toml:"config_args,omitempty"`
// ConfigExecTimeout in seconds
ConfigExecTimeout int `toml:"config_exec_timeout,omitempty"`
// PrepareExec path to prepare executable
PrepareExec string `toml:"prepare_exec,omitempty"`
// PrepareArgs for prepare
PrepareArgs []string `toml:"prepare_args,omitempty"`
// PrepareExecTimeout in seconds
PrepareExecTimeout int `toml:"prepare_exec_timeout,omitempty"`
// RunExec path to run executable
RunExec string `toml:"run_exec,omitempty"`
// RunArgs for run
RunArgs []string `toml:"run_args,omitempty"`
// CleanupExec path to cleanup executable
CleanupExec string `toml:"cleanup_exec,omitempty"`
// CleanupArgs for cleanup
CleanupArgs []string `toml:"cleanup_args,omitempty"`
// CleanupExecTimeout in seconds
CleanupExecTimeout int `toml:"cleanup_exec_timeout,omitempty"`
// GracefulKillTimeout for graceful shutdown
GracefulKillTimeout int `toml:"graceful_kill_timeout,omitempty"`
// ForceKillTimeout before force kill
ForceKillTimeout int `toml:"force_kill_timeout,omitempty"`
}
CustomConfig holds custom executor configuration.
type DockerConfig ¶
type DockerConfig struct {
// Image is the default Docker image to use
Image string `toml:"image,omitempty"`
// Hostname for the container
Hostname string `toml:"hostname,omitempty"`
// Memory limit in bytes
Memory string `toml:"memory,omitempty"`
// MemorySwap limit in bytes
MemorySwap string `toml:"memory_swap,omitempty"`
// MemoryReservation soft limit in bytes
MemoryReservation string `toml:"memory_reservation,omitempty"`
// CPUs limit
CPUs string `toml:"cpus,omitempty"`
// CPUSetCPUs to use
CPUSetCPUs string `toml:"cpuset_cpus,omitempty"`
// DNS servers for container
DNS []string `toml:"dns,omitempty"`
// DNSSearch domains
DNSSearch []string `toml:"dns_search,omitempty"`
// Privileged mode
Privileged bool `toml:"privileged,omitempty"`
// DisableEntrypointOverwrite prevents entrypoint override
DisableEntrypointOverwrite bool `toml:"disable_entrypoint_overwrite,omitempty"`
// DisableCache disables Docker cache
DisableCache bool `toml:"disable_cache,omitempty"`
// Volumes to mount
Volumes []string `toml:"volumes,omitempty"`
// VolumeDriver to use
VolumeDriver string `toml:"volume_driver,omitempty"`
// CacheDir for Docker cache
CacheDir string `toml:"cache_dir,omitempty"`
// ExtraHosts entries
ExtraHosts []string `toml:"extra_hosts,omitempty"`
// NetworkMode for container
NetworkMode string `toml:"network_mode,omitempty"`
// Links to other containers
Links []string `toml:"links,omitempty"`
// Services to start
Services []DockerService `toml:"services,omitempty"`
// WaitForServicesTimeout in seconds
WaitForServicesTimeout int `toml:"wait_for_services_timeout,omitempty"`
// AllowedImages patterns
AllowedImages []string `toml:"allowed_images,omitempty"`
// AllowedServices patterns
AllowedServices []string `toml:"allowed_services,omitempty"`
// PullPolicy for images (never, if-not-present, always)
PullPolicy string `toml:"pull_policy,omitempty"`
// ShmSize in bytes
ShmSize int64 `toml:"shm_size,omitempty"`
// Tmpfs mounts
Tmpfs map[string]string `toml:"tmpfs,omitempty"`
// ServicesPrivileged runs services in privileged mode
ServicesPrivileged bool `toml:"services_privileged,omitempty"`
// CapAdd capabilities to add
CapAdd []string `toml:"cap_add,omitempty"`
// CapDrop capabilities to drop
CapDrop []string `toml:"cap_drop,omitempty"`
// SecurityOpt options
SecurityOpt []string `toml:"security_opt,omitempty"`
// Devices to expose
Devices []string `toml:"devices,omitempty"`
// GPUs configuration
GPUs string `toml:"gpus,omitempty"`
// UsernsMode user namespace mode
UsernsMode string `toml:"userns_mode,omitempty"`
// SysCtls kernel parameters
SysCtls map[string]string `toml:"sysctls,omitempty"`
// TLSVerify enables TLS verification
TLSVerify bool `toml:"tls_verify,omitempty"`
// TLSCertPath for client certificates
TLSCertPath string `toml:"tls_cert_path,omitempty"`
// Helper image to use
HelperImage string `toml:"helper_image,omitempty"`
}
DockerConfig holds Docker executor configuration.
type DockerService ¶
type DockerService struct {
// Name/image of the service
Name string `toml:"name,omitempty"`
// Alias for the service
Alias string `toml:"alias,omitempty"`
// Entrypoint override
Entrypoint []string `toml:"entrypoint,omitempty"`
// Command override
Command []string `toml:"command,omitempty"`
// Environment variables
Environment []string `toml:"environment,omitempty"`
}
DockerService represents a service container configuration.
type KubernetesConfig ¶
type KubernetesConfig struct {
// Host is the Kubernetes API server URL
Host string `toml:"host,omitempty"`
// CertFile for Kubernetes auth
CertFile string `toml:"cert_file,omitempty"`
// KeyFile for Kubernetes auth
KeyFile string `toml:"key_file,omitempty"`
// CAFile for Kubernetes auth
CAFile string `toml:"ca_file,omitempty"`
// BearerTokenOverwriteAllowed allows token override
BearerTokenOverwriteAllowed bool `toml:"bearer_token_overwrite_allowed,omitempty"`
// BearerToken for Kubernetes auth
BearerToken string `toml:"bearer_token,omitempty"`
// Image is the default image
Image string `toml:"image,omitempty"`
// Namespace for pods
Namespace string `toml:"namespace,omitempty"`
// NamespaceOverwriteAllowed allows namespace override
NamespaceOverwriteAllowed string `toml:"namespace_overwrite_allowed,omitempty"`
// Privileged mode for pods
Privileged bool `toml:"privileged,omitempty"`
// AllowPrivilegeEscalation in containers
AllowPrivilegeEscalation bool `toml:"allow_privilege_escalation,omitempty"`
// CPULimit for pods
CPULimit string `toml:"cpu_limit,omitempty"`
// CPULimitOverwriteMaxAllowed max allowed CPU limit override
CPULimitOverwriteMaxAllowed string `toml:"cpu_limit_overwrite_max_allowed,omitempty"`
// CPURequest for pods
CPURequest string `toml:"cpu_request,omitempty"`
// CPURequestOverwriteMaxAllowed max allowed CPU request override
CPURequestOverwriteMaxAllowed string `toml:"cpu_request_overwrite_max_allowed,omitempty"`
// MemoryLimit for pods
MemoryLimit string `toml:"memory_limit,omitempty"`
// MemoryLimitOverwriteMaxAllowed max allowed memory limit override
MemoryLimitOverwriteMaxAllowed string `toml:"memory_limit_overwrite_max_allowed,omitempty"`
// MemoryRequest for pods
MemoryRequest string `toml:"memory_request,omitempty"`
// MemoryRequestOverwriteMaxAllowed max allowed memory request override
MemoryRequestOverwriteMaxAllowed string `toml:"memory_request_overwrite_max_allowed,omitempty"`
// ServiceAccount for pods
ServiceAccount string `toml:"service_account,omitempty"`
// ServiceAccountOverwriteAllowed allows service account override
ServiceAccountOverwriteAllowed string `toml:"service_account_overwrite_allowed,omitempty"`
// PodAnnotations for all pods
PodAnnotations map[string]string `toml:"pod_annotations,omitempty"`
// PodAnnotationsOverwriteAllowed allows annotation override
PodAnnotationsOverwriteAllowed string `toml:"pod_annotations_overwrite_allowed,omitempty"`
// PodLabels for all pods
PodLabels map[string]string `toml:"pod_labels,omitempty"`
// NodeSelector for pod scheduling
NodeSelector map[string]string `toml:"node_selector,omitempty"`
// NodeTolerations for pod scheduling
NodeTolerations map[string]string `toml:"node_tolerations,omitempty"`
// ImagePullSecrets for pulling images
ImagePullSecrets []string `toml:"image_pull_secrets,omitempty"`
// HelperImage for the helper container
HelperImage string `toml:"helper_image,omitempty"`
// TerminationGracePeriodSeconds for pods
TerminationGracePeriodSeconds int64 `toml:"termination_grace_period_seconds,omitempty"`
// PollInterval for pod status
PollInterval int `toml:"poll_interval,omitempty"`
// PollTimeout for pod status
PollTimeout int `toml:"poll_timeout,omitempty"`
// PodSecurityContext for all pods
PodSecurityContext *KubernetesPodSecurityContext `toml:"pod_security_context,omitempty"`
// Volumes to mount
Volumes *KubernetesVolumes `toml:"volumes,omitempty"`
// Services configuration
Services []KubernetesService `toml:"services,omitempty"`
// DNSPolicy for pods
DNSPolicy string `toml:"dns_policy,omitempty"`
// DNSConfig for pods
DNSConfig *KubernetesDNSConfig `toml:"dns_config,omitempty"`
}
KubernetesConfig holds Kubernetes executor configuration.
type KubernetesConfigMap ¶
type KubernetesConfigMap struct {
Name string `toml:"name,omitempty"`
MountPath string `toml:"mount_path,omitempty"`
SubPath string `toml:"sub_path,omitempty"`
ReadOnly bool `toml:"read_only,omitempty"`
Items map[string]string `toml:"items,omitempty"`
}
KubernetesConfigMap represents a ConfigMap volume.
type KubernetesDNSConfig ¶
type KubernetesDNSConfig struct {
Nameservers []string `toml:"nameservers,omitempty"`
Options []KubernetesDNSConfigOption `toml:"options,omitempty"`
Searches []string `toml:"searches,omitempty"`
}
KubernetesDNSConfig holds DNS configuration.
type KubernetesDNSConfigOption ¶
type KubernetesDNSConfigOption struct {
Name string `toml:"name,omitempty"`
Value string `toml:"value,omitempty"`
}
KubernetesDNSConfigOption holds a DNS config option.
type KubernetesEmptyDir ¶
type KubernetesEmptyDir struct {
Name string `toml:"name,omitempty"`
MountPath string `toml:"mount_path,omitempty"`
SubPath string `toml:"sub_path,omitempty"`
Medium string `toml:"medium,omitempty"`
}
KubernetesEmptyDir represents an EmptyDir volume.
type KubernetesHostPath ¶
type KubernetesHostPath struct {
Name string `toml:"name,omitempty"`
MountPath string `toml:"mount_path,omitempty"`
SubPath string `toml:"sub_path,omitempty"`
ReadOnly bool `toml:"read_only,omitempty"`
HostPath string `toml:"host_path,omitempty"`
}
KubernetesHostPath represents a host path volume.
type KubernetesPVC ¶
type KubernetesPVC struct {
Name string `toml:"name,omitempty"`
MountPath string `toml:"mount_path,omitempty"`
SubPath string `toml:"sub_path,omitempty"`
ReadOnly bool `toml:"read_only,omitempty"`
}
KubernetesPVC represents a PVC volume.
type KubernetesPodSecurityContext ¶
type KubernetesPodSecurityContext struct {
// FSGroup for volume permissions
FSGroup int64 `toml:"fs_group,omitempty"`
// RunAsGroup for all containers
RunAsGroup int64 `toml:"run_as_group,omitempty"`
// RunAsNonRoot enforces non-root user
RunAsNonRoot bool `toml:"run_as_non_root,omitempty"`
// RunAsUser for all containers
RunAsUser int64 `toml:"run_as_user,omitempty"`
// SupplementalGroups for file access
SupplementalGroups []int64 `toml:"supplemental_groups,omitempty"`
}
KubernetesPodSecurityContext holds pod security context.
type KubernetesSecret ¶
type KubernetesSecret struct {
Name string `toml:"name,omitempty"`
MountPath string `toml:"mount_path,omitempty"`
SubPath string `toml:"sub_path,omitempty"`
ReadOnly bool `toml:"read_only,omitempty"`
Items map[string]string `toml:"items,omitempty"`
}
KubernetesSecret represents a Secret volume.
type KubernetesService ¶
type KubernetesService struct {
Name string `toml:"name,omitempty"`
Alias string `toml:"alias,omitempty"`
Command []string `toml:"command,omitempty"`
}
KubernetesService represents a service container.
type KubernetesVolumes ¶
type KubernetesVolumes struct {
// HostPath volumes
HostPath []KubernetesHostPath `toml:"host_path,omitempty"`
// PVC volumes
PVC []KubernetesPVC `toml:"pvc,omitempty"`
// ConfigMap volumes
ConfigMap []KubernetesConfigMap `toml:"config_map,omitempty"`
// Secret volumes
Secret []KubernetesSecret `toml:"secret,omitempty"`
// EmptyDir volumes
EmptyDir []KubernetesEmptyDir `toml:"empty_dir,omitempty"`
}
KubernetesVolumes holds volume configurations.
type MachineConfig ¶
type MachineConfig struct {
// IdleCount is the number of machines to keep idle
IdleCount int `toml:"IdleCount,omitempty"`
// IdleScaleFactor scales idle machines based on load
IdleScaleFactor float64 `toml:"IdleScaleFactor,omitempty"`
// IdleCountMin minimum idle machines
IdleCountMin int `toml:"IdleCountMin,omitempty"`
// IdleTime in seconds before machine is removed
IdleTime int `toml:"IdleTime,omitempty"`
// MaxGrowthRate limits machine creation rate
MaxGrowthRate int `toml:"MaxGrowthRate,omitempty"`
// MaxBuilds per machine before removal
MaxBuilds int `toml:"MaxBuilds,omitempty"`
// MachineName template
MachineName string `toml:"MachineName,omitempty"`
// MachineDriver to use (aws, google, azure, etc.)
MachineDriver string `toml:"MachineDriver,omitempty"`
// MachineOptions for the driver
MachineOptions []string `toml:"MachineOptions,omitempty"`
// OffPeakPeriods time periods for reduced capacity
OffPeakPeriods []string `toml:"OffPeakPeriods,omitempty"`
// OffPeakTimezone for off-peak periods
OffPeakTimezone string `toml:"OffPeakTimezone,omitempty"`
// OffPeakIdleCount during off-peak periods
OffPeakIdleCount int `toml:"OffPeakIdleCount,omitempty"`
// OffPeakIdleTime during off-peak periods
OffPeakIdleTime int `toml:"OffPeakIdleTime,omitempty"`
}
MachineConfig holds docker-machine executor configuration.
type Runner ¶
type Runner struct {
// Name is the runner's name
Name string `toml:"name,omitempty"`
// URL is the GitLab instance URL
URL string `toml:"url,omitempty"`
// Token is the runner's authentication token
Token string `toml:"token,omitempty"`
// Executor is the executor type (shell, docker, kubernetes, etc.)
Executor string `toml:"executor,omitempty"`
// Limit is the maximum number of concurrent jobs for this runner
Limit int `toml:"limit,omitempty"`
// OutputLimit is the maximum build log size in KB
OutputLimit int `toml:"output_limit,omitempty"`
// Environment variables for all builds
Environment []string `toml:"environment,omitempty"`
// PreBuildScript runs before each build
PreBuildScript string `toml:"pre_build_script,omitempty"`
// PostBuildScript runs after each build
PostBuildScript string `toml:"post_build_script,omitempty"`
// PreCloneScript runs before git operations
PreCloneScript string `toml:"pre_clone_script,omitempty"`
// Shell specifies the shell to use
Shell string `toml:"shell,omitempty"`
// BuildsDir is the directory for builds
BuildsDir string `toml:"builds_dir,omitempty"`
// CacheDir is the directory for caches
CacheDir string `toml:"cache_dir,omitempty"`
// CloneURL overrides the clone URL
CloneURL string `toml:"clone_url,omitempty"`
// Cache configuration
Cache *CacheConfig `toml:"cache,omitempty"`
// Docker configuration
Docker *DockerConfig `toml:"docker,omitempty"`
// Kubernetes configuration
Kubernetes *KubernetesConfig `toml:"kubernetes,omitempty"`
// Machine (docker-machine) configuration
Machine *MachineConfig `toml:"machine,omitempty"`
// Custom executor configuration
Custom *CustomConfig `toml:"custom,omitempty"`
}
Runner represents a single runner configuration.
type SessionServer ¶
type SessionServer struct {
// ListenAddress for the session server
ListenAddress string `toml:"listen_address,omitempty"`
// AdvertiseAddress for the session server
AdvertiseAddress string `toml:"advertise_address,omitempty"`
// SessionTimeout in seconds
SessionTimeout int `toml:"session_timeout,omitempty"`
}
SessionServer configures the session server for interactive web terminals.