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 ¶ added in v0.0.7
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 ¶ added in v0.0.11
type ExistingUpdates []ExistingUpdate
func (ExistingUpdates) LatestGroupUpdate ¶ added in v0.0.11
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 ¶ added in v0.0.2
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 ¶ added in v0.0.3
type Groups ¶ added in v0.0.2
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 ¶ added in v0.0.2
func (Groups) GroupDependencies ¶ added in v0.0.2
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 ¶ added in v0.0.17
func WithBranchNamer(branchNamer UpdateBranchNamer) RepoUpdaterOpt
func WithGroups ¶ added in v0.0.2
func WithGroups(groups ...*Group) RepoUpdaterOpt
type SignedUpdateGroup ¶ added in v0.0.9
type SignedUpdateGroup struct { Updates UpdateGroup `json:"signed"` Signature []byte `json:"signature"` }
func NewSignedUpdateGroup ¶ added in v0.0.9
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 ¶ added in v0.0.9
func NewUpdateGroup ¶ added in v0.0.9
func NewUpdateGroup(name string, updates ...Update) UpdateGroup
func VerifySignedUpdateGroup ¶ added in v0.0.9
func VerifySignedUpdateGroup(key []byte, signed SignedUpdateGroup) (*UpdateGroup, error)