Documentation
¶
Overview ¶
Package install downloads, verifies and installs the pinned Chrome for Testing build that Daisybell drives. Daisybell never uses any other browser binary (SPEC §2.1).
Index ¶
- Constants
- func Cleanup(root, current string)
- func CompareVersions(a, b string) int
- func ExecutableRel(platform string) string
- func Extract(zipPath, dest string) error
- func ParseDownloadURL(data []byte, platform string) (string, error)
- func ParseVersion(out string) string
- func Platform(goos, goarch string) (string, bool)
- func RunVersion(ctx context.Context, exe string) (string, error)
- func VersionURL(version string) string
- func ZipURL(base, version, platform string) string
- type Artifact
- type Installer
- func (i *Installer) Dir() string
- func (i *Installer) DownloadURL(ctx context.Context) (string, error)
- func (i *Installer) Ensure(ctx context.Context) (string, error)
- func (i *Installer) Executable() string
- func (i *Installer) Install(ctx context.Context) (string, error)
- func (i *Installer) InstallZip(ctx context.Context, zipPath string) (string, error)
- func (i *Installer) Installed() bool
Constants ¶
const DefaultBaseURL = "https://storage.googleapis.com/chrome-for-testing-public"
DefaultBaseURL is the official Chrome for Testing download root. Mirrors use the same layout.
const PinnedVersion = "154.0.8037.92"
PinnedVersion is the Chrome for Testing build Daisybell uses (Stable channel as of 2026-10-03). Bumping it requires updating pinnedArtifacts below.
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶
func Cleanup(root, current string)
Cleanup keeps the current version plus the newest previous one and removes leftovers.
func CompareVersions ¶
CompareVersions compares dotted numeric versions; it returns -1, 0 or 1.
func ExecutableRel ¶
ExecutableRel is the executable path inside the extracted zip, slash-separated.
func Extract ¶
Extract unzips zipPath into dest, preserving permissions and relative symlinks (macOS .app bundles need them) and rejecting entries that would escape dest.
func ParseDownloadURL ¶
ParseDownloadURL extracts the chrome zip URL for platform from a version JSON document.
func ParseVersion ¶
ParseVersion extracts "154.0.8037.92" from "Google Chrome for Testing 154.0.8037.92".
func RunVersion ¶
RunVersion runs "<exe> --version". On Windows chrome.exe prints nothing, so the version is read from the "<version>.manifest" file next to the executable.
func VersionURL ¶
VersionURL is the official JSON endpoint describing one version's downloads.
Types ¶
type Artifact ¶
Artifact is what we expect to download for one platform: exact byte size and the base64 MD5 that Google Cloud Storage publishes in the x-goog-hash header. Pinning both in the binary means a tampered or truncated download is rejected even when served over a proxy or mirror.
func PinnedArtifact ¶
PinnedArtifact returns the expected artifact for platform when version is the pinned one.
type Installer ¶
type Installer struct {
Root string // e.g. ~/.daisybell/browsers
Version string
Platform string
// BaseURL, when set, is a mirror with the official path layout; the version JSON is skipped.
BaseURL string
// VersionJSON is the endpoint describing the version's downloads (overridable in tests).
VersionJSON string
Client *http.Client
// Progress receives human-readable progress lines (stderr in production). May be nil.
Progress io.Writer
// VersionOf runs the executable and reports its version (overridable in tests).
VersionOf func(ctx context.Context, exe string) (string, error)
// Expected, when non-nil, pins the size and MD5 of the zip.
Expected *Artifact
}
Installer installs one Chrome for Testing version into Root/<version>.
func New ¶
New returns the production installer for the pinned version on the current platform. The HTTP client honours HTTPS_PROXY/HTTP_PROXY/NO_PROXY.
func (*Installer) DownloadURL ¶
DownloadURL resolves the zip URL: mirror layout if BaseURL is set, otherwise the official JSON (falling back to the official layout when the JSON is unreachable).
func (*Installer) Executable ¶
Executable is the path of the browser executable (it may not exist yet).
func (*Installer) Install ¶
Install downloads, verifies and atomically installs the browser. It returns the executable.
func (*Installer) InstallZip ¶
InstallZip extracts the zip into a staging directory, verifies the executable reports the expected version, then renames the staging directory into place.