Documentation
¶
Overview ¶
Package versions brings the packages' lists of versions up to date with what the registry holds.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoMerger ¶ added in v0.15.0
AutoMerger turns on auto-merge for a pull request.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller updates the lists of versions.
func New ¶
func New(registry Registry, automerge AutoMerger, blobs g2.Blobs, baseBranch string) *Controller
New creates a Controller. automerge may be nil, and then the pull request waits for somebody. blobs reads the lists when no ids are given, to find the ones behind.
func (*Controller) DryRun ¶ added in v0.15.0
func (c *Controller) DryRun()
DryRun makes Update say which lists are behind and commit nothing.
func (*Controller) Update ¶ added in v0.15.0
Update makes the versions.json of each package whose id is given say what its versions directory on the base branch holds, in one pull request.
A pull request adding a version leaves the package's list alone, because two of them open for one package would conflict on it. So the list falls behind when one merges, and this is what brings it up: it is run for the packages a merge touched.
Each list is made from the base branch, and committed onto the open pull request when there is one, which only ever changes lists: what it holds of an older base is replaced by what the base holds now, and nothing else the base gained since is touched.
No ids means every package whose list is behind. With a pull request open, behind is asked of the lists it holds rather than of the base branch's, since a list it already brings up to date has nothing left to do.
type Registry ¶
type Registry interface {
VersionsListFile(ctx context.Context, logger *slog.Logger, ref, id string) (*g2.File, error)
File(ctx context.Context, ref, path string) (string, error)
BranchSHA(ctx context.Context, branch string) (string, error)
Commit(ctx context.Context, branch, parent, message string, files []*g2.File) error
VersionsPullRequest(ctx context.Context) (*gogithub.PullRequest, error)
CreateVersionsPullRequest(ctx context.Context, logger *slog.Logger, base, title, body string) (*gogithub.PullRequest, error)
StaleVersionsLists(ctx context.Context, logger *slog.Logger, blobs g2.Blobs, listRef string) ([]string, error)
}
Registry is the part of aqua-registry-g2 an update of the lists reads and writes.