Documentation
¶
Index ¶
- func BinaryName(targetOS string) string
- func BuildDownloadURL(version, os, arch string) string
- func BuildSHA256SumsURL(version string) string
- func CreateAgentToken(ctx context.Context, f *factory.Factory, org, clusterID, description string) (string, error)
- func DefaultBinDir(targetOS string) string
- func DefaultBuildPath(targetOS string) string
- func DefaultConfigPath(targetOS string) string
- func DownloadToTemp(url string) (string, error)
- func ExtractBinary(archive, dest, targetOS string) error
- func FetchExpectedSHA256(sumsURL, archiveFilename string) (string, error)
- func FindCluster(ctx context.Context, f *factory.Factory, org, clusterID string) (string, error)
- func ResolveLatestVersion() (string, error)
- func VerifySHA256(path, expected string) error
- func WriteAgentConfig(path, token, buildPath string, tags []string) error
- type ExistingInstall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryName ¶ added in v3.33.0
BinaryName returns the platform-appropriate binary name.
func BuildDownloadURL ¶ added in v3.33.0
BuildDownloadURL returns the GitHub releases URL for the given agent version, OS, and arch.
func BuildSHA256SumsURL ¶ added in v3.33.0
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
DefaultBinDir returns the platform-appropriate default directory for the agent binary.
func DefaultBuildPath ¶ added in v3.33.0
DefaultBuildPath returns the platform-appropriate default directory for agent builds.
func DefaultConfigPath ¶ added in v3.33.0
DefaultConfigPath returns the platform-appropriate default path for the agent config file.
func DownloadToTemp ¶ added in v3.33.0
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
ExtractBinary extracts the buildkite-agent binary from the given archive to dest.
func FetchExpectedSHA256 ¶ added in v3.33.0
FetchExpectedSHA256 downloads the SHA256SUMS file and returns the expected hash for the given archive filename.
func FindCluster ¶ added in v3.33.0
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
ResolveLatestVersion queries the GitHub API for the latest buildkite-agent release tag.
func VerifySHA256 ¶ added in v3.33.0
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
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
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.