Documentation
¶
Overview ¶
Package tooling manages the pinned command-line tools used by Radius builds.
Index ¶
- func ExpandTemplate(template string, values map[string]string) (string, error)
- func GenerateMake(m Manifest) ([]byte, error)
- func SyncVersionFiles(root string, tool Tool) error
- func WriteMakeFile(path string, manifest Manifest) (bool, error)
- func WriteManifest(path string, manifest Manifest) (bool, error)
- func WriteTextFile(path, contents string) (bool, error)
- type ChecksumSource
- type Client
- type HTTPClient
- type Manifest
- type Platform
- type Release
- type Source
- type Tool
- type UpdateResult
- type VersionFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandTemplate ¶
ExpandTemplate expands the small, explicit template language used by the manifest and rejects unknown variables instead of silently producing a bad URL.
func GenerateMake ¶
GenerateMake returns the generated Make include containing only metadata values. Tool installation recipes remain in build/tools.mk.
func SyncVersionFiles ¶
SyncVersionFiles updates the declared consumers of a tool version. Plain files are replaced completely; replace files update the value between their declared prefix and suffix exactly once.
func WriteMakeFile ¶
WriteMakeFile writes generated Make metadata only when its contents change.
func WriteManifest ¶
WriteManifest patches tool versions and checksums into the manifest, preserving its existing formatting, and writes only when contents change.
func WriteTextFile ¶
WriteTextFile writes a text file only when its contents change.
Types ¶
type ChecksumSource ¶
type ChecksumSource struct {
Type string `yaml:"type"`
FileTemplate string `yaml:"fileTemplate,omitempty"`
OrderFileTemplate string `yaml:"orderFileTemplate,omitempty"`
URLTemplate string `yaml:"urlTemplate,omitempty"`
Format string `yaml:"format,omitempty"`
Integrity string `yaml:"integrity,omitempty"`
}
ChecksumSource describes where a release asset's SHA-256 checksum comes from.
type Client ¶
type Client struct {
HTTP HTTPClient
Token string
UserAgent string
// contains filtered or unexported fields
}
Client retrieves release metadata and checksum sources.
func NewClient ¶
NewClient constructs a source client. GITHUB_TOKEN and GH_TOKEN are honored to keep local and GitHub Actions runs equivalent.
type HTTPClient ¶
HTTPClient is the subset of http.Client used by the updater.
type Manifest ¶
type Manifest struct {
SchemaVersion int `yaml:"schemaVersion"`
CooldownDays int `yaml:"cooldownDays,omitempty"`
Platforms []string `yaml:"platforms"`
Tools []Tool `yaml:"tools"`
}
Manifest is the source of truth for the versions, release sources, assets, and checksums of the external tools used by the repository.
func LoadManifest ¶
LoadManifest reads and validates a tool manifest.
type Platform ¶
type Platform struct {
Asset string `yaml:"asset"`
Checksum string `yaml:"checksum"`
OS string `yaml:"os,omitempty"`
Arch string `yaml:"arch,omitempty"`
}
Platform describes a release asset and its pinned checksum for one target platform. Asset names may contain manifest template variables.
type Release ¶
Release is the newest version advertised by a tool's source, with the time it was published when the source reports one.
type Source ¶
type Source struct {
Type string `yaml:"type"`
Repository string `yaml:"repository,omitempty"`
TagPrefix string `yaml:"tagPrefix,omitempty"`
LatestURL string `yaml:"latestURL"`
}
Source describes how the updater discovers a tool's latest version.
func (Source) ReportsReleaseDate ¶
ReportsReleaseDate reports whether the updater can determine when a source's latest release was published, which the cooldown requires. A stable-text source carries no timestamp, so it needs a repository to resolve one.
type Tool ¶
type Tool struct {
Name string `yaml:"name"`
MakePrefix string `yaml:"makePrefix"`
Version string `yaml:"version"`
Update *bool `yaml:"update,omitempty"`
Notes string `yaml:"notes,omitempty"`
Source Source `yaml:"source"`
DownloadTemplate string `yaml:"downloadTemplate,omitempty"`
Platforms map[string]Platform `yaml:"platforms,omitempty"`
ChecksumSource ChecksumSource `yaml:"checksumSource"`
VersionFiles []VersionFile `yaml:"versionFiles,omitempty"`
}
Tool describes one pinned external tool.
func (Tool) TagForVersion ¶
TagForVersion converts a manifest version into its release tag.
func (Tool) TemplateValues ¶
TemplateValues builds the values used by asset and URL templates.
func (Tool) UpdatesEnabled ¶
UpdatesEnabled reports whether the updater may advance the tool's version.
func (Tool) VersionFromTag ¶
VersionFromTag converts a release tag into the manifest's version format.
type UpdateResult ¶
UpdateResult reports the manifest values the updater changed and the newer releases it deferred because they are still inside the cooldown.
func UpdateManifest ¶
UpdateManifest refreshes versions and checksums in memory. It writes no files, so a failed source lookup cannot leave a partially updated manifest.
type VersionFile ¶
type VersionFile struct {
Path string `yaml:"path"`
Format string `yaml:"format"`
Prefix string `yaml:"prefix,omitempty"`
Suffix string `yaml:"suffix,omitempty"`
}
VersionFile describes a repository file that must stay synchronized with a tool version when the tool is not only consumed through Make.