agent

package
v3.38.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryName added in v3.33.0

func BinaryName(targetOS string) string

BinaryName returns the platform-appropriate binary name.

func BuildDownloadURL added in v3.33.0

func BuildDownloadURL(version, os, arch string) string

BuildDownloadURL returns the GitHub releases URL for the given agent version, OS, and arch.

func BuildSHA256SumsURL added in v3.33.0

func BuildSHA256SumsURL(version string) string

BuildSHA256SumsURL returns the URL for the SHA256SUMS file for a given agent version.

func CreateAgentToken added in v3.33.0

func CreateAgentToken(ctx context.Context, f *factory.Factory, org, clusterID, description string) (string, error)

CreateAgentToken creates an agent token on the given cluster and returns the token string.

func DefaultBinDir added in v3.33.0

func DefaultBinDir(targetOS string) string

DefaultBinDir returns the platform-appropriate default directory for the agent binary.

func DefaultBuildPath added in v3.33.0

func DefaultBuildPath(targetOS string) string

DefaultBuildPath returns the platform-appropriate default directory for agent builds.

func DefaultConfigPath added in v3.33.0

func DefaultConfigPath(targetOS string) string

DefaultConfigPath returns the platform-appropriate default path for the agent config file.

func DownloadToTemp added in v3.33.0

func DownloadToTemp(url string) (string, error)

DownloadToTemp downloads the given URL to a temporary file and returns its path. The caller is responsible for removing the file when done.

func ExtractBinary added in v3.33.0

func ExtractBinary(archive, dest, targetOS string) error

ExtractBinary extracts the buildkite-agent binary from the given archive to dest.

func FetchExpectedSHA256 added in v3.33.0

func FetchExpectedSHA256(sumsURL, archiveFilename string) (string, error)

FetchExpectedSHA256 downloads the SHA256SUMS file and returns the expected hash for the given archive filename.

func FindCluster added in v3.33.0

func FindCluster(ctx context.Context, f *factory.Factory, org, clusterID string) (string, error)

FindCluster resolves a cluster for the given org. If clusterID is provided, it is returned directly. Otherwise it looks up the "Default" cluster.

func ResolveLatestVersion added in v3.33.0

func ResolveLatestVersion() (string, error)

ResolveLatestVersion queries the GitHub API for the latest buildkite-agent release tag.

func VerifySHA256 added in v3.33.0

func VerifySHA256(path, expected string) error

VerifySHA256 computes the SHA256 hash of the file at path and compares it to the expected hex-encoded hash. Returns an error if they don't match.

func WriteAgentConfig added in v3.33.0

func WriteAgentConfig(path, token, buildPath string, tags []string) error

WriteAgentConfig writes a minimal agent config file with the given token, build path, and optional tags. The file is created with 0600 permissions.

Types

type ExistingInstall added in v3.33.0

type ExistingInstall struct {
	Path    string
	Version string
}

ExistingInstall describes a buildkite-agent binary already present on the system.

func FindExisting added in v3.33.0

func FindExisting(targetOS string) *ExistingInstall

FindExisting looks for buildkite-agent in PATH and returns info about it. Returns nil if no existing installation is found.

Jump to

Keyboard shortcuts

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