Documentation
¶
Index ¶
- Constants
- Variables
- func LoadRepoPolicies(policies *Policies) error
- func NewParams(paramNames ...string) runParameters
- func NonTrivialDiff(dir string, colours bool) ([]string, error)
- type Bundle
- type GitRepo
- func (r *GitRepo) AddFile(path string) (plumbing.Hash, error)
- func (r *GitRepo) Branch() string
- func (r *GitRepo) Branches(re string) ([]string, error)
- func (r *GitRepo) Commit(msg string) error
- func (r *GitRepo) CreateFile(path string) (*os.File, error)
- func (r *GitRepo) CreatePR(bv any, prtitle, remoteBranch string, draft bool) (*github.PullRequest, error)
- func (r *GitRepo) DeleteRemoteBranch(remoteBranch string) error
- func (r *GitRepo) EnableAutoMerge(prID string) error
- func (r *GitRepo) EnableSigning(key *openpgp.Entity) error
- func (r *GitRepo) FetchBranch(branch string) error
- func (r *GitRepo) PRs() []string
- func (r *GitRepo) PullBranch(branch string) error
- func (r *GitRepo) Push(remoteBranch string) error
- func (r *GitRepo) RenderPRTemplate(body *string, bv any) (*bytes.Buffer, error)
- func (r *GitRepo) SetDryRun(dryRun bool)
- type Policies
- type RepoPolicy
- func (rp *RepoPolicy) GetAllBranches() []string
- func (rp *RepoPolicy) GetTimeStamp() (time.Time, error)
- func (rp *RepoPolicy) ProcessBranch(opDir, branch, msg string, repo *GitRepo) (string, error)
- func (rp *RepoPolicy) SetBranch(branch string) error
- func (rp *RepoPolicy) SetTimestamp(ts time.Time)
- func (rp RepoPolicy) String() string
- type TestVariations
Constants ¶
const ( UNKNOWN_VALIDATOR validator = iota GORELEASER GHA )
Variables ¶
var Green = "\033[32m"
var LBlue = "\033[94m"
var Red = "\033[31m"
var Reset = "\033[0m"
var White = "\033[97m"
var Yellow = "\033[33m"
Functions ¶
func LoadRepoPolicies ¶
LoadRepoPolicies populates the supplied policies with the policy key from a the config file This will panic if the type assertions fail
Types ¶
type Bundle ¶ added in v1.4.7
type Bundle struct { Name string // contains filtered or unexported fields }
Bundle represents a directory tree, instantiated by NewBundle()
func (*Bundle) Add ¶ added in v1.4.7
Add adds the path and corresponding template into the templateNode tree This code due to ChatGPT
type GitRepo ¶ added in v1.6.0
GitRepo models a local git worktree with the authentication and enough metadata to allow it to be pushed it to github
func InitGit ¶ added in v1.6.0
InitGit is a constructor for the GitRepo type private repos will need ghToken
func (*GitRepo) AddFile ¶ added in v1.6.0
AddFile adds a file in the worktree to the index. The file is assumed to have been updated prior to calling this function.
func (*GitRepo) Branch ¶ added in v1.6.0
Branch returns the short name of the ref HEAD is pointing to - provided the ref is a branch. Returns empty string if ref is not a branch.
func (*GitRepo) Branches ¶ added in v1.6.0
(r *GitRepo) Branches will return a list of branches matching the supplied regexp for the repo
func (*GitRepo) Commit ¶ added in v1.6.0
Commit adds all unstaged changes and commits the current worktree, confirming if asked Note that this commit will be lost if it is not pushed to a remote.
func (*GitRepo) CreateFile ¶ added in v1.6.0
CreateFile will create a file in a directory, truncating it if it already exists with the embedded git worktree. Any intermediate directories are also created.
func (*GitRepo) CreatePR ¶ added in v1.6.0
func (r *GitRepo) CreatePR(bv any, prtitle, remoteBranch string, draft bool) (*github.PullRequest, error)
CreatePR will create a PR using the user supplied title and the embedded PR body If a PR already exists, it will return that PR
func (*GitRepo) DeleteRemoteBranch ¶ added in v1.6.0
DeleteRemoteBranch deletes the given branch from the remote origin, this is mainly used in the test functions to delete the test branches, but can also be called from other contexts. Please note that it operates only on the origin remote.
func (*GitRepo) EnableAutoMerge ¶ added in v1.6.0
EnableAutoMergePR uses the graphQL github v4 API with the PR ID (not number) to mutate graphQL PR object to enable automerge
func (*GitRepo) EnableSigning ¶ added in v1.6.0
(r *GitRepo) EnableSignging will enable commits to be signed for this repo
func (*GitRepo) FetchBranch ¶ added in v1.6.0
(r *GitRepo) FetchBranch fetches the given ref and then checks it out to the worktree Any local changes are lost. If the branch does not exist in the `origin` remote, an error is returned
func (*GitRepo) PullBranch ¶ added in v1.6.0
(r *GitRepo) FetchBranch fetches the given ref and then checks it out to the worktree Any local changes are lost. If the branch does not exist in the `origin` remote, an error is returned
func (*GitRepo) RenderPRTemplate ¶ added in v1.6.0
RenderPRTemplate will fill in the supplied template body with values from GitRepo
type Policies ¶
type Policies map[string]repoConfig
Policies models the config file structure. There are three levels at which a particular value can be set: group-level, repo, branch. The group level is applicable for all the repos in that group. Repeating the same repo in multiple groups is UB
func (*Policies) GetRepoPolicy ¶ added in v1.6.0
func (p *Policies) GetRepoPolicy(repo string) (RepoPolicy, error)
GetRepoPolicy will fetch the RepoPolicy for the supplied repo with all overrides (group, repo, branch levels) processed. This is the constructor for RepoPolicy.
type RepoPolicy ¶
type RepoPolicy struct { Name string Description string Default string PCPrivate bool PCRepo string DHRepo string CSRepo string Binary string PackageName string Reviewers []string ExposePorts string Cgo bool ConfigFile string VersionPackage string UpgradeFromVer string Branch string Branchvals branchVals Branches map[string]branchVals Timestamp string Visibility string // contains filtered or unexported fields }
RepoPolicy is used to render templates. It provides an abstraction between config.yaml and the templates. It is instantiated from Policies for a particular repo and branch and the constructor implements all the overriding/merging logic between the various levels of the Policies type.
func (*RepoPolicy) GetAllBranches ¶ added in v1.6.0
func (rp *RepoPolicy) GetAllBranches() []string
GetAllBranches returns all the branches that are managed for this repo
func (*RepoPolicy) GetTimeStamp ¶
func (rp *RepoPolicy) GetTimeStamp() (time.Time, error)
GetTimeStamp returns the timestamp currently set for the given repopolicy.
func (*RepoPolicy) ProcessBranch ¶ added in v1.6.0
func (rp *RepoPolicy) ProcessBranch(opDir, branch, msg string, repo *GitRepo) (string, error)
ProcessBranch will render the templates into a git worktree for the supplied branch, commit and push the changes upstream The upstream branch name is the supplied branch name prefixed with releng/ and is returned
func (*RepoPolicy) SetBranch ¶ added in v1.6.0
func (rp *RepoPolicy) SetBranch(branch string) error
SetBranch sets the Branch and Branchvals properties so that templates can simply access them instead of looking them up in the Branches map
func (*RepoPolicy) SetTimestamp ¶
func (rp *RepoPolicy) SetTimestamp(ts time.Time)
SetTimestamp Sets the given time as the repopolicy timestamp. If called with zero time sets the current time in UTC
func (RepoPolicy) String ¶ added in v1.6.0
func (rp RepoPolicy) String() string
Stringer implementation for RepoPolicy
type TestVariations ¶ added in v1.6.1
TestVariations models the variations of the test matrix in release.yml:api-tests. Each key is a row in the matrix.