desktoprelease

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelBeta   = "beta"
	ChannelStable = "stable"

	ChannelBranchPrefix = "channel-"
	ChannelDirectory    = "desktop"

	ManifestMac       = "latest-mac.yml"
	ManifestLinux     = "latest-linux.yml"
	GenerationFile    = "generation.json"
	CompatibilityFile = "compat.json"
	ChecksumsFile     = "checksums.txt"
)
View Source
const DefaultGitHubAPIURL = "https://api.github.com"

Variables

View Source
var ErrChannelRefNotFound = errors.New("desktop release: channel ref not found")
View Source
var ErrCompareAndSwap = errors.New("desktop release: channel ref changed")

Functions

func AssertCompatibleWithPrevious

func AssertCompatibleWithPrevious(minAppVersion, previousAppVersion string) error

func AssertExactDesktopInventory

func AssertExactDesktopInventory(ctx context.Context, dir, version string) error

func AssertStrictlyGreater

func AssertStrictlyGreater(candidate, live string) error

func CompatibilityChannels

func CompatibilityChannels(channel string) ([]string, error)

CompatibilityChannels returns the channels whose live apps a release on channel must keep serving. Stable releases also serve the frozen beta channel, whose final bridge release reads the stable feed.

func DesktopArtifactNames

func DesktopArtifactNames(version string) []string

func LoadChannelFiles

func LoadChannelFiles(dir string) (map[string][]byte, error)

func MinAppVersion

func MinAppVersion(releaseVersion string, liveVersions []string) (string, error)

MinAppVersion returns the lowest live app version across the compatibility channels, which the new runtime must keep serving. Without a live channel the release version is its own minimum.

func ValidateDesktopChannel

func ValidateDesktopChannel(channel string) error

func ValidateVersion

func ValidateVersion(version string) error

func VerifyChecksumsCatalog

func VerifyChecksumsCatalog(ctx context.Context, catalogPath string, artifacts []Artifact) error

func WriteCompatibility

func WriteCompatibility(path string, compatibility Compatibility) error

Types

type Artifact

type Artifact struct {
	Name   string `json:"name"`
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
}

func InspectDesktopInventory

func InspectDesktopInventory(ctx context.Context, dir, version string) ([]Artifact, error)

type Authority

type Authority struct {
	// contains filtered or unexported fields
}

func NewAuthority

func NewAuthority(backend AuthorityBackend) (*Authority, error)

func (*Authority) Publish

func (a *Authority) Publish(ctx context.Context, request PublishRequest) (OperatorResult, error)

func (*Authority) Repair

func (a *Authority) Repair(ctx context.Context, request RepairRequest) (OperatorResult, error)

type AuthorityBackend

type AuthorityBackend interface {
	Repository() string
	ChannelRef(ctx context.Context, branch string) (string, error)
	FindOperation(ctx context.Context, branch, operationID string) (*ChannelCommit, error)
	Commit(ctx context.Context, request CommitRequest) (string, error)
	CompareAndSwapRef(ctx context.Context, branch, expectedSHA, nextSHA string) error
	ReleaseInventory(ctx context.Context, version string) ([]Artifact, error)
	UploadAsset(ctx context.Context, version, path string, artifact Artifact) error
	VerifyAsset(ctx context.Context, version string, artifact Artifact) error
	ReadCommit(ctx context.Context, sha string) (ChannelCommit, error)
	KnownGood(ctx context.Context, branch, version string) (ChannelCommit, error)
}

type ChannelCommit

type ChannelCommit struct {
	SHA        string
	Generation Generation
	Files      map[string][]byte
}

type CommitRequest

type CommitRequest struct {
	ParentSHA  string
	Generation Generation
	Files      map[string][]byte
}

type Compatibility

type Compatibility struct {
	RuntimeVersion string `json:"runtime_version"`
	MinAppVersion  string `json:"min_app_version"`
}

func ReadCompatibility

func ReadCompatibility(path string) (Compatibility, error)

type ErrorCode

type ErrorCode string
const (
	ErrorInventoryIncomplete ErrorCode = "inventory_incomplete"
	ErrorChannelCASConflict  ErrorCode = "channel_cas_conflict"
	ErrorVerificationFailed  ErrorCode = "verification_failed"
)

func CodeOf

func CodeOf(err error) ErrorCode

type Generation

type Generation struct {
	OperationID   string    `json:"operation_id"`
	Operation     string    `json:"operation"`
	Version       string    `json:"version"`
	MinAppVersion string    `json:"min_app_version"`
	PublishedAt   time.Time `json:"published_at"`
	SourceCommit  string    `json:"source_commit,omitempty"`
}

func DecodeGeneration

func DecodeGeneration(contents []byte) (Generation, error)

type GitHubBackend

type GitHubBackend struct {
	// contains filtered or unexported fields
}

func NewGitHubBackend

func NewGitHubBackend(client HTTPDoer, apiURL, repository, token string) (*GitHubBackend, error)

func (*GitHubBackend) ChannelRef

func (b *GitHubBackend) ChannelRef(ctx context.Context, branch string) (string, error)

func (*GitHubBackend) Commit

func (b *GitHubBackend) Commit(ctx context.Context, request CommitRequest) (string, error)

func (*GitHubBackend) CompareAndSwapRef

func (b *GitHubBackend) CompareAndSwapRef(
	ctx context.Context,
	branch, expectedSHA, nextSHA string,
) error

func (*GitHubBackend) FindOperation

func (b *GitHubBackend) FindOperation(
	ctx context.Context,
	branch, operationID string,
) (*ChannelCommit, error)

func (*GitHubBackend) KnownGood

func (b *GitHubBackend) KnownGood(
	ctx context.Context,
	branch, version string,
) (ChannelCommit, error)

func (*GitHubBackend) ReadCommit

func (b *GitHubBackend) ReadCommit(ctx context.Context, sha string) (ChannelCommit, error)

func (*GitHubBackend) ReleaseInventory

func (b *GitHubBackend) ReleaseInventory(ctx context.Context, version string) ([]Artifact, error)

func (*GitHubBackend) Repository

func (b *GitHubBackend) Repository() string

func (*GitHubBackend) UploadAsset

func (b *GitHubBackend) UploadAsset(
	ctx context.Context,
	version, filePath string,
	artifact Artifact,
) error

func (*GitHubBackend) VerifyAsset

func (b *GitHubBackend) VerifyAsset(ctx context.Context, version string, artifact Artifact) error

type HTTPDoer

type HTTPDoer interface {
	Do(request *http.Request) (*http.Response, error)
}

type OperatorError

type OperatorError struct {
	Code ErrorCode `json:"code"`
	Err  error     `json:"-"`
}

func (*OperatorError) Error

func (e *OperatorError) Error() string

func (*OperatorError) Unwrap

func (e *OperatorError) Unwrap() error

type OperatorResult

type OperatorResult struct {
	Operation         string     `json:"operation"`
	ChannelRefBefore  string     `json:"channel_ref_before"`
	ChannelRefAfter   string     `json:"channel_ref_after"`
	VerifiedInventory []Artifact `json:"verified_inventory"`
	AuditCommit       string     `json:"audit_commit"`
	Outcome           string     `json:"outcome"`
}

type PublishRequest

type PublishRequest struct {
	OperationID string
	Channel     string
	Version     string
	AssetDir    string
	ChannelDir  string
	PublishedAt time.Time
}

type RepairRequest

type RepairRequest struct {
	OperationID string
	Channel     string
	Version     string
	PublishedAt time.Time
}

Jump to

Keyboard shortcuts

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