dates

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package dates fills in, for the versions the registry already holds, when the release each came from was published.

registry.json has said it since ar2 v0.5.0, and the files written before that don't. Nothing can work it out from them: the version string doesn't say it, and for a package whose tags aren't semver there is nothing else to order releases by at all. So it is read off the releases and written in.

This is not a regeneration. Nothing about a version is generated again -- no asset is downloaded, no definition is consulted, nothing already in the file is touched -- which is what makes it a push onto the package branch rather than a pull request per package: the diff of each file is one field, and the release it was read from is what says whether it is right.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	// Packages narrows the run to the packages named. Naming none does every package.
	Packages []string
	// Limit bounds how many packages one run writes to, 0 for as many as there are.
	Limit int
	// DryRun says what would be written without writing it.
	DryRun bool
}

Args holds what one run does.

type Controller

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

Controller fills in the dates.

func New

func New(registry Registry, releases Releases, defs map[string]string) *Controller

New creates a Controller.

func (*Controller) Fill

func (c *Controller) Fill(ctx context.Context, logger *slog.Logger, args *Args) error

Fill works through the packages, filling in the date of every version that hasn't one.

A package already filled in costs the reads that establish so and no write, so a second run over a registry that is done is idempotent rather than a no-op by luck.

type Registry

type Registry interface {
	Branch(pkgName string) (string, bool)
	BranchSHA(ctx context.Context, branch string) (string, error)
	VersionsOnRef(ctx context.Context, logger *slog.Logger, ref string) (map[string]struct{}, error)
	File(ctx context.Context, ref, path string) (string, error)
	Push(ctx context.Context, branch, parent, message string, files []*g2.File) error
}

Registry is the part of aqua-registry-g2 this reads and writes.

type Releases

type Releases interface {
	ListReleases(ctx context.Context, owner, repo string, opts *gogithub.ListOptions) ([]*gogithub.RepositoryRelease, *gogithub.Response, error)
}

Releases lists the releases of an upstream repository.

Jump to

Keyboard shortcuts

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