Documentation
¶
Index ¶
- Variables
- func GetTemplateContent(osType commonParams.OSType, forge params.EndpointType) ([]byte, error)
- func RenderRunnerInstallScript(tpl string, context any) ([]byte, error)
- func RenderRunnerInstallWrapper(ctx context.Context, osType commonParams.OSType, ...) ([]byte, error)
- func ValidateTemplate(data []byte) error
- type InstallContext
- type WrapperContext
Constants ¶
This section is empty.
Variables ¶
var Userdata embed.FS
Functions ¶
func GetTemplateContent ¶
func GetTemplateContent(osType commonParams.OSType, forge params.EndpointType) ([]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
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
}