oci

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package oci publishes Homebrew bottles to an OCI registry using the exact conventions brew expects when pouring from GHCR (Homebrew's github_packages.rb is the reference implementation):

  • image path: <host>/<root path>/<formula> — the formula name is the last path element because brew appends it to the formula's root_url
  • one OCI *index* per version, tagged "version[-rebuild]" (brew always parses the manifest response as an index, even for a single platform)
  • index children carry sh.brew.bottle.digest, sh.brew.tab and org.opencontainers.image.ref.name="version.tag[.rebuild]" annotations — all three are read by brew at install time
  • the layer blob is the bottle tar.gz byte-for-byte, so its digest equals the sha256 in the formula's bottle block

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImageFormulaName

func ImageFormulaName(formula string) string

ImageFormulaName sanitizes a formula name for use as an OCI path element, mirroring GitHubPackages.image_formula_name: "@" -> "/", "+" -> "x".

Types

type Authenticator

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

Authenticator handles GHCR authentication

func NewAuthenticator

func NewAuthenticator(host, token string) *Authenticator

NewAuthenticator creates an authenticator from token

func (*Authenticator) GetAuthConfig

func (a *Authenticator) GetAuthConfig() authn.AuthConfig

GetAuthConfig returns the authn.AuthConfig for go-containerregistry

func (*Authenticator) Keychain

func (a *Authenticator) Keychain() authn.Keychain

Keychain returns an authn.Keychain for go-containerregistry

type PublishOptions

type PublishOptions struct {
	SourceURL   string    // org.opencontainers.image.source (links the GHCR package to a repo)
	Homepage    string    // org.opencontainers.image.url + org.opencontainers.image.documentation
	License     string    // org.opencontainers.image.licenses + sh.brew.license
	Description string    // org.opencontainers.image.description
	FullName    string    // org.opencontainers.image.title: tap-qualified formula name, e.g. "user/tap/formula" (brew's formula_full_name; drives GHCR's install snippet)
	Vendor      string    // org.opencontainers.image.vendor (the owning user/org)
	Created     time.Time // org.opencontainers.image.created; zero omits it (keeps pushes deterministic)
}

PublishOptions holds metadata rendered into OCI annotations.

type Publisher

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

Publisher pushes bottles for a single formula to an OCI registry.

func NewPublisher

func NewPublisher(host, rootPath, formula, token string, opts PublishOptions) (*Publisher, error)

NewPublisher creates a publisher for <host>/<rootPath>/<formula>. rootPath is everything between the registry host and the formula name (e.g. "myorg/tap"); brew's root_url is then "https://<host>/v2/<rootPath>".

func (*Publisher) AnonymouslyAccessible

func (p *Publisher) AnonymouslyAccessible(ctx context.Context, tag string) (bool, error)

AnonymouslyAccessible reports whether the given tag can be fetched without credentials — the way brew pulls (Bearer QQ==). A false result almost always means the GHCR package is still private and must be made public before anyone can `brew install` from it.

func (*Publisher) Push

func (p *Publisher) Push(ctx context.Context, bottles []*bottle.Bottle, log func(string)) ([]Result, error)

Push publishes all bottles, one OCI index per version[-rebuild] tag. If an index already exists at the tag, other-platform children are preserved (brew pr-upload's --keep-old behavior) and matching platforms are replaced.

func (*Publisher) Repository

func (p *Publisher) Repository() string

Repository returns the full image path (host/rootPath/formula).

type Result

type Result struct {
	Tag     string // e.g. "1.2.3" or "1.2.3-1"
	Ref     string // full tagged reference
	Digest  string // index digest (empty on dry runs)
	Bottles []*bottle.Bottle
}

Result describes one pushed (or to-be-pushed) index.

Jump to

Keyboard shortcuts

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