Documentation
¶
Overview ¶
Package update finds, installs, and restarts onto codeaf releases.
Index ¶
- Constants
- func ChannelTag(channel, date, sha string) (string, error)
- func CleanupOld(string)
- func CleanupOldRunning(func() (string, error))
- func CompareChannelBuilds(running string, runningPublished time.Time, selected string, ...) (int, bool)
- func CompareSemverTags(left, right string) (int, bool)
- func CurlLine(executable, channel string) string
- func ExecutableTarget(executable func() (string, error)) (string, error)
- func FollowedChannel(running string) string
- func Kind(tag string) string
- func NextSemverTag(tags []string, channel, component string) (string, error)
- func ParseChannel(tag string) (channel, date string, ok bool)
- func Restart(plan Plan) error
- func RestartArgs(original []string, transcript string) []string
- func ValidDate(value string) bool
- func ValidSHA(value string) bool
- type Available
- type CheckOptions
- type Choice
- type Client
- type InstallOptions
- type InstallResult
- type Plan
- type RCTag
- type Release
- type Version
Constants ¶
const ( // CurlCommand is the independent installation road shown at launch beside // /update and after a failed or unavailable in-place update. IT IS THE // SUPPORTED LINE, NOT THE SCRIPT UNDER IT: agentfield.ai/get/codeaf serves // scripts/install.sh from main, and the address is the one a person can // remember and the one every other place codeaf documents spells, so a // launch line and the README can never hand out two different roads. CurlCommand = "curl -fsSL https://agentfield.ai/get/codeaf | bash" NoUpdateCheckEnv = "CODEAF_NO_UPDATE_CHECK" GitHubAPIEnv = "CODEAF_GITHUB_API" GitHubDownloadEnv = "CODEAF_GITHUB_DOWNLOAD" )
const ( // CheckTimeout is the whole-exchange budget for a launch check and for // `codeaf update --check`. THE CHECK CLOCK NEVER COVERS AN INSTALL: a // release asset is allowed to make steady progress for much longer. CheckTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func ChannelTag ¶
ChannelTag forms a dev or staging tag from a date and revision.
func CleanupOld ¶
func CleanupOld(string)
CleanupOld removes nothing on systems where the running executable can be replaced directly.
func CleanupOldRunning ¶
CleanupOldRunning does nothing where replacing a running executable leaves no backup. In particular, it does not resolve the executable during launch.
func CompareChannelBuilds ¶ added in v0.4.0
func CompareChannelBuilds(running string, runningPublished time.Time, selected string, selectedPublished time.Time) (int, bool)
CompareChannelBuilds compares a running build with the release selected by the API from the same channel. A negative result means the selected release is newer; a positive result means the running build is ahead.
func CompareSemverTags ¶
CompareSemverTags orders stable and release-candidate tags. A stable tag follows every release candidate on its own version line.
func CurlLine ¶ added in v0.4.0
CurlLine returns the independent installation road for the running file and release channel. The product remains codeaf; only the destination file name changes when a differently named executable asks for its own road back.
func ExecutableTarget ¶
ExecutableTarget resolves the running binary before an installer replaces it.
func FollowedChannel ¶ added in v0.4.0
FollowedChannel names the release channel a build takes its updates from. IT IS NOT ALWAYS THE CHANNEL THE TAG WAS CUT ON: a release candidate follows STABLE, because its launch line, its bare /update and its bare `codeaf update` all speak about the stable release its line is heading for. A build from source follows stable too, so the road it is offered is the ordinary one. Only dev and staging follow themselves. Every place that has to answer "which channel is this build on" asks here, so the launch notice and the curl line under it can never name two different roads.
func NextSemverTag ¶
NextSemverTag returns the next stable or release-candidate tag.
func ParseChannel ¶ added in v0.4.0
ParseChannel returns the channel and calendar date carried by a dev or staging tag. The date is kept as YYYYMMDD because that spelling sorts in the same order as the days it names.
func RestartArgs ¶
RestartArgs keeps the original launch shape and points it at this transcript.
Types ¶
type Available ¶
type Available struct {
Latest string
Running string
LatestPublished time.Time
RunningPublished time.Time
Curl string
}
Available is the release comparison shown at launch or by --check.
func CheckLaunch ¶
func CheckLaunch(ctx context.Context, options CheckOptions) (Available, bool)
CheckLaunch silently checks the release channel this build follows. Every failure is absence at this surface.
func (Available) Ahead ¶ added in v0.4.0
Ahead reports whether this build is newer than the release selected from its own channel. Source builds and incomparable channels are never called ahead.
type CheckOptions ¶
type CheckOptions struct {
Running string
ProfileDir string
Client *Client
Now func() time.Time
Disabled bool
Executable string
}
CheckOptions supplies the launch policy's disk, clock, and release client.
type Client ¶
type Client struct {
HTTP *http.Client
APIBase string
DownloadBase string
Token string
Revision string
CheckWindow time.Duration
APIWindow time.Duration
StallWindow time.Duration
DownloadCeiling time.Duration
}
Client talks to the release API and release asset host.
func NewClient ¶
NewClient builds the release client from the same mirror and token inputs as the shell installer. The timeout belongs only to the small release check; every install request carries the clock for the particular thing it reads.
type InstallOptions ¶
type InstallOptions struct {
Client *Client
Release Release
Target string
Curl string
GOOS string
GOARCH string
}
InstallOptions describes one in-place replacement.
type InstallResult ¶
InstallResult is the release and executable path that are ready to restart.
func Install ¶
func Install(ctx context.Context, options InstallOptions) (InstallResult, error)
Install downloads, checks, and atomically replaces one executable.
type Release ¶
type Release struct {
Tag string
Repository string
PublishedAt time.Time
RunningPublishedAt time.Time
}
Release is one selected GitHub release and the repository that answered.