Documentation
¶
Overview ¶
Package add puts a package the registry doesn't have into it.
Everything else a run does is about a package it already knows: the order comes from the state, and the state is built from aqua-registry's list. A package aqua-registry doesn't have -- one somebody asked for in an issue -- has no way in at all, which is what this is.
Two things make a package known. Its definition, in its own directory, which is what generating reads; and its place in the order, which is what decides when it is generated. Neither follows from the other, so both are written here, and either can already be there: this is run again after a failure rather than unpicked.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller adds packages.
func (*Controller) Add ¶
Add writes the package's definition and puts it into the order.
It reports whether the state changed, which is what says the caller has to store it. The definition goes first: a package in the order whose branch holds no definition is reached by a run that then has nothing to generate from, while a definition nothing has ordered simply waits.
type Input ¶
type Input struct {
// PkgName is the aqua package name, which is the repository for most packages and
// a command inside one for the rest: kubernetes/kubernetes/kubectl.
PkgName string
// Repo is the repository, as "<owner>/<name>". Empty reads it from PkgName.
Repo string
// Commands are the executables the package installs. Empty means one named after
// the last part of PkgName, which is what the release is inferred to hold.
Commands []string
// State is the order the package joins.
State *state.State
// DryRun renders the definition and writes nothing.
DryRun bool
}
Input is the package to add.
type Registry ¶
type Registry interface {
Config(ctx context.Context, pkgName string) (*aquag2.Config, error)
PackageBase(ctx context.Context, pkgName string) (string, error)
// HeadBranch is the branch the pull request is opened from. It answers false for a
// package the registry doesn't hold, which is every package until PackageBase has
// minted the id it is kept under.
HeadBranch(pkgName string) (string, bool)
CommitPackage(ctx context.Context, logger *slog.Logger, pkgName, branch, parent, message string, files []*g2.File) error
CreatePullRequest(ctx context.Context, logger *slog.Logger, pkgName, title, body string) (*gogithub.PullRequest, error)
}
Registry is what a package is added to.
type Repositories ¶
type Repositories interface {
Get(ctx context.Context, owner, repo string) (*gogithub.Repository, *gogithub.Response, error)
}
Repositories reads the repository the package comes from, for the description the catalogue lists it under.