templates

package
v0.2.3-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Userdata embed.FS

Functions

func GetTemplateContent

func GetTemplateContent(osType commonParams.OSType, forge params.EndpointType) ([]byte, error)

func RenderRunnerInstallScript

func RenderRunnerInstallScript(tpl string, context any) ([]byte, error)

func RenderRunnerInstallWrapper

func RenderRunnerInstallWrapper(ctx context.Context, osType commonParams.OSType, metadataURL, callbackURL, token string, proxyConfig commonParams.ProxyConfig) ([]byte, error)

func ValidateTemplate added in v0.2.2

func ValidateTemplate(data []byte) error

ValidateTemplate performs parse-time validation of a runner install template.

It only parses the template; it deliberately does NOT execute it. Parsing validates the grammar (delimiter balance, pipelines, block/end matching and references to known functions) without ever inspecting the render context, so it is completely independent of the variable data a template is rendered against — most notably the per-pool ExtraSpecs/ExtraContext map. A reference such as `{{ index .ExtraContext "gitea_cache_address" }}` is valid regardless of which keys exist at render time. Executing to validate would be both unsound (the context is unknown and variable at save time) and unnecessary (a missing map key yields "" rather than an error), which is why parse-time is exactly the right level.

Types

type InstallContext

type InstallContext struct {
	cloudconfig.InstallRunnerParams
	AgentMode        bool
	AgentDownloadURL string
	AgentURL         string
	AgentToken       string
	AgentShell       string // "true" or "false", used verbatim in TOML config
	// ForceInsecureGARMAgent allows the agent to connect back to GARM even when
	// TLS is not enabled in GARM itself.
	ForceInsecureGARMAgent bool

	// HTTPProxy, HTTPSProxy and NoProxy hold the final proxy URLs (with
	// credentials embedded, if any) and the proxy bypass list. Templates
	// render these into the garm-agent config. Note that garm-agent
	// versions older than v0.1.1 do not know about the proxy section, so
	// templates must only emit it when a proxy is actually set.
	HTTPProxy  string
	HTTPSProxy string
	NoProxy    string
}

InstallContext wraps the vendored InstallRunnerParams with agent-specific fields so templates can render agent values directly without requiring the runner to fetch metadata and parse it with jq at runtime.

type WrapperContext

type WrapperContext struct {
	CallbackToken string
	CallbackURL   string
	MetadataURL   string
	CACertBundle  string

	// HTTPProxy, HTTPSProxy and NoProxy hold the final proxy URLs (with
	// credentials embedded, if any) and the proxy bypass list. The wrappers
	// export these as environment variables. The install scripts and the
	// runner itself inherit them. On Windows, where PowerShell 5.1 ignores
	// proxy environment variables, the wrapper also sets the .NET default
	// web proxy from these values.
	HTTPProxy  string
	HTTPSProxy string
	NoProxy    string
}

Jump to

Keyboard shortcuts

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