Documentation ¶
Overview ¶
Package updater is general logic for analyzing and updating a source project's dependencies
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultUpdateBranchNamer ¶
type DefaultUpdateBranchNamer struct{}
func (DefaultUpdateBranchNamer) Format ¶
func (d DefaultUpdateBranchNamer) Format(baseBranch string, update Update) string
func (DefaultUpdateBranchNamer) FormatBatch ¶
func (d DefaultUpdateBranchNamer) FormatBatch(baseBranch, batchName string) string
type Dependency ¶
type Dependency struct { // Path is the name of the dependency. Path string Version string // Indirect indicates this dependency is only required by a dependency of the target project. Indirect bool }
Dependency is an updatable external artifact
type ExistingUpdate ¶
type ExistingUpdate struct { // Is this update still in a proposed state? Open bool // If not open, was this update accepted? Merged bool BaseBranch string LastUpdate time.Time Group UpdateGroup }
ExistingUpdate is a previously proposed update(s).
type ExistingUpdates ¶
type ExistingUpdates []ExistingUpdate
func (ExistingUpdates) LatestGroupUpdate ¶
func (e ExistingUpdates) LatestGroupUpdate(group string) (latest time.Time)
type Factory ¶
Factory provides UpdaterS for testing, masking any arguments other than the repo root.
type Group ¶
type Group struct { // Identify the group and members: // Name labels unique groups Name string `yaml:"name"` // Pattern is a prefix for the dependency, or a regular expression enclosed by /'s Pattern string `yaml:"pattern"` // Parameters that apply to members: // Range is a comma separated list of allowed semver ranges Range string `yaml:"range"` CoolDown string `yaml:"cooldown"` PreScript string `yaml:"pre-script"` PostScript string `yaml:"post-script"` // contains filtered or unexported fields }
func (*Group) CoolDownDuration ¶
type Groups ¶
type Groups []*Group
Groups is an ordered list of Group with unique names. Prefer a list with .Name to map[string]Group for clear iteration order.
func ParseGroups ¶
func (Groups) GroupDependencies ¶
func (g Groups) GroupDependencies(deps []Dependency) (byGroupName map[string][]Dependency, ungrouped []Dependency)
GroupDependencies groups dependencies according to this configuration.
type Repo ¶
type Repo interface { // Root returns the working tree root. // This should minimally contain go.{mod,sum}. Vendoring or major updates require the full tree. Root() string // SetBranch changes to an existing branch. SetBranch(branch string) error // NewBranch creates and changes to a new branch. NewBranch(base, branch string) error // Branch returns the current branch. Branch() string // Push snapshots the working tree after an update has been applied, and "publishes". // This is branch to commit. Publishing may mean push, create a PR, tweet the maintainer, whatever. Push(context.Context, UpdateGroup) error // Fetch loads a remote ref without updating the working copy. Fetch(ctx context.Context, branch string) error // ExistingUpdates returns the state of recent updates ExistingUpdates(ctx context.Context, baseBranch string) (ExistingUpdates, error) }
Repo interfaces with an SCM repository, probably Git.
type RepoUpdater ¶
type RepoUpdater struct { Updater Updater // contains filtered or unexported fields }
RepoUpdater creates branches proposing all available updates for a Go module.
func NewRepoUpdater ¶
func NewRepoUpdater(repo Repo, updater Updater, opts ...RepoUpdaterOpt) *RepoUpdater
NewRepoUpdater creates RepoUpdater.
func (*RepoUpdater) Update ¶
func (u *RepoUpdater) Update(ctx context.Context, baseBranch, branchName string, updates UpdateGroup) error
Update creates a single update branch included the Repo.
type RepoUpdaterOpt ¶
type RepoUpdaterOpt func(*RepoUpdater)
func WithBranchNamer ¶
func WithBranchNamer(branchNamer UpdateBranchNamer) RepoUpdaterOpt
func WithGroups ¶
func WithGroups(groups ...*Group) RepoUpdaterOpt
type SignedUpdateGroup ¶
type SignedUpdateGroup struct { Updates UpdateGroup `json:"signed"` Signature []byte `json:"signature"` }
func NewSignedUpdateGroup ¶
func NewSignedUpdateGroup(key []byte, updates UpdateGroup) (SignedUpdateGroup, error)
type Update ¶
type Update struct { // Path of module being updated Path string `json:"path"` // Previous module version Previous string `json:"previous"` // Next module version Next string `json:"next"` }
Update specifies changes to the version of a specific module path
type UpdateBranchNamer ¶
type UpdateBranchNamer interface { // Format generates branch name for an update Format(baseBranch string, update Update) string // Format generates branch name for batch of updates FormatBatch(baseBranch, batchName string) string }
UpdateBranchNamer names branches for proposed updates.
type UpdateGroup ¶
func NewUpdateGroup ¶
func NewUpdateGroup(name string, updates ...Update) UpdateGroup
func VerifySignedUpdateGroup ¶
func VerifySignedUpdateGroup(key []byte, signed SignedUpdateGroup) (*UpdateGroup, error)