Documentation ¶
Index ¶
- Constants
- Variables
- func ChangelogDirExists(fs afero.Fs, changelogParentPath string) (bool, error)
- func GenerateChangelogForTags(ctx context.Context, tags []string, reader ChangelogReader, w io.Writer) error
- func GenerateChangelogFromLocalDirectory(ctx context.Context, repoRootPath, owner, repo, changelogDirPath string, ...) error
- func GenerateChangelogMarkdown(changelog *Changelog) string
- func GetChangelogFilesAdded(ctx context.Context, client githubutils.RepoClient, base, sha string) ([]github.CommitFile, error)
- func GetChangelogMarkdownForPR(owner, repo string) (string, error)
- func GetLatestTag(ctx context.Context, owner, repo string) (string, error)
- func GetProposedTag(fs afero.Fs, latestTag, changelogParentPath string) (string, error)
- func GetProposedTagForRepo(ctx context.Context, client *github.Client, owner, repo string) (string, error)deprecated
- func GetValidationSettingsPath() string
- func IsInvalidDirectoryNameError(err error) bool
- func IsKnownChangelogFile(path string) bool
- func IsMultipleVersionsFoundError(err error) bool
- func IsNoVersionFoundError(err error) bool
- func RefHasChangelog(ctx context.Context, client *github.Client, owner, repo, sha string) (bool, error)deprecated
- type Changelog
- type ChangelogEntry
- type ChangelogEntryType
- type ChangelogFile
- type ChangelogList
- type ChangelogReader
- type ChangelogTmplData
- type ChangelogValidator
- type TagComparator
- type ValidationSettings
Constants ¶
View Source
const ( // all functions in this file that use ChangelogDirectory are marked deprecated. The hope // is we don't need to account for the "ActiveSubdirectory" setting which was added _after_ said deprecation ChangelogDirectory = "changelog" SummaryFile = "summary.md" ClosingFile = "closing.md" )
View Source
const ( MasterBranch = "master" ValidationSettingsFile = "validation.yaml" )
Variables ¶
View Source
var ( MountLocalDirectoryError = func(err error) error { return errors.Wrapf(err, "unable to mount local directory") } ReadChangelogDirError = func(err error) error { return errors.Wrapf(err, "unable to read changelog directory") } GetChangelogForTagError = func(err error) error { return errors.Wrapf(err, "unable to get changelog for tag") } GenerateChangelogSummaryTemplateError = func(err error) error { return errors.Wrapf(err, "unable to generate changelog summary from template") } )
View Source
var ( UnableToListFilesError = func(err error, directory string) error { return errors.Wrapf(err, "Unable to list files in directory %s", directory) } UnexpectedDirectoryError = func(name, directory string) error { return eris.Errorf("Unexpected directory %s in changelog directory %s", name, directory) } UnableToReadSummaryFileError = func(err error, path string) error { return errors.Wrapf(err, "Unable to read summary file %s", path) } UnableToReadClosingFileError = func(err error, path string) error { return errors.Wrapf(err, "Unable to read closing file %s", path) } NoEntriesInChangelogError = func(filename string) error { return eris.Errorf("No changelog entries found in file %s.", filename) } UnableToParseChangelogError = func(err error, path string) error { return errors.Wrapf(err, "File %s is not a valid changelog file.", path) } MissingIssueLinkError = eris.Errorf("Changelog entries must have an issue link") MissingDescriptionError = eris.Errorf("Changelog entries must have a description") MissingOwnerError = eris.Errorf("Dependency bumps must have an owner") MissingRepoError = eris.Errorf("Dependency bumps must have a repo") MissingTagError = eris.Errorf("Dependency bumps must have a tag") )
View Source
var ( NoChangelogFileAddedError = eris.Errorf("A changelog file must be added. For more information, check out https://github.com/solo-io/go-utils/tree/master/changelogutils.") TooManyChangelogFilesAddedError = func(filesAdded int) error { return eris.Errorf("Only one changelog file can be added in a PR, found %d.", filesAdded) } UnexpectedFileInChangelogDirectoryError = func(name string) error { return eris.Errorf("Found unexpected file %s in changelog directory.", name) } InvalidChangelogSubdirectoryNameError = func(name string) error { return eris.Errorf("%s is not a valid changelog directory name, must be a semver version.", name) } ListReleasesError = func(err error) error { return errors.Wrapf(err, "Error listing releases") } MultipleNewVersionsFoundError = func(latest, version1, version2 string) error { return eris.Errorf("Only one version greater than the latest release %s valid, found %s and %s.", latest, version1, version2) } NoNewVersionsFoundError = func(latest string) error { return eris.Errorf("No new versions greater than the latest release %s found.", latest) } AddedChangelogInOldVersionError = func(latest string) error { return eris.Errorf("Can only add changelog to unreleased version (currently %s)", latest) } InvalidUseOfStableApiError = func(tag string) error { return eris.Errorf("Changelog indicates this is a stable API release, which should be used only to indicate the release of v1.0.0, not %s", tag) } UnexpectedProposedVersionError = func(expected, actual string) error { return eris.Errorf("Expected version %s to be next changelog version, found %s", expected, actual) } UnableToGetSettingsError = func(err error) error { return errors.Wrapf(err, "Unable to read settings file") } InvalidLabelError = func(label string, allowed []string) error { return eris.Errorf("Changelog version has label %s, which isn't in the list of allowed labels: %v", label, allowed) } ExpectedVersionLabelError = func(actual string) error { return eris.Errorf("Expected version %s to to have a semver label suffix", actual) } )
Functions ¶
func ChangelogDirExists ¶
Deprecated
func GenerateChangelogForTags ¶ added in v0.10.16
func GenerateChangelogFromLocalDirectory ¶ added in v0.10.16
func GetChangelogFilesAdded ¶ added in v0.11.8
func GetChangelogFilesAdded(ctx context.Context, client githubutils.RepoClient, base, sha string) ([]github.CommitFile, error)
func GetLatestTag ¶
Should return the last released version Deprecated: use githubutils.RepoClient.FindLatestReleaseIncludingPrerelease instead
func GetProposedTag ¶
Should return the next version to release, based on the names of the subdirectories in the changelog Will return an error if there is no version, or multiple versions, larger than the latest tag, according to semver Deprecated: use ChangelogValidator instead
func GetValidationSettingsPath ¶ added in v0.11.3
func GetValidationSettingsPath() string
func IsKnownChangelogFile ¶ added in v0.11.4
func IsNoVersionFoundError ¶
Types ¶
type Changelog ¶
type Changelog struct { Files []*ChangelogFile Summary string Version *versionutils.Version Closing string }
type ChangelogEntry ¶
type ChangelogEntry struct { Type ChangelogEntryType `json:"type"` Description string `json:"description"` IssueLink string `json:"issueLink"` DependencyOwner string `json:"dependencyOwner,omitempty"` DependencyRepo string `json:"dependencyRepo,omitempty"` DependencyTag string `json:"dependencyTag,omitempty"` ResolvesIssue *bool `json:"resolvesIssue,omitempty"` }
func (*ChangelogEntry) GetResolvesIssue ¶
func (c *ChangelogEntry) GetResolvesIssue() bool
type ChangelogEntryType ¶
type ChangelogEntryType int
const ( BREAKING_CHANGE ChangelogEntryType = iota FIX NEW_FEATURE NON_USER_FACING DEPENDENCY_BUMP HELM UPGRADE )
func (ChangelogEntryType) BreakingChange ¶
func (clt ChangelogEntryType) BreakingChange() bool
func (ChangelogEntryType) MarshalJSON ¶
func (clt ChangelogEntryType) MarshalJSON() ([]byte, error)
func (ChangelogEntryType) NewFeature ¶ added in v0.10.28
func (clt ChangelogEntryType) NewFeature() bool
func (ChangelogEntryType) String ¶
func (clt ChangelogEntryType) String() string
func (*ChangelogEntryType) UnmarshalJSON ¶
func (clt *ChangelogEntryType) UnmarshalJSON(data []byte) error
type ChangelogFile ¶
type ChangelogFile struct { Entries []*ChangelogEntry `json:"changelog,omitempty"` ReleaseStableApi *bool `json:"releaseStableApi,omitempty"` }
func ReadChangelogFile
deprecated
func ReadChangelogFile(fs afero.Fs, path string) (*ChangelogFile, error)
Deprecated: use changelogutils.ChangelogReader instead
func (*ChangelogFile) GetReleaseStableApi ¶
func (c *ChangelogFile) GetReleaseStableApi() bool
func (*ChangelogFile) HasBreakingChange ¶
func (c *ChangelogFile) HasBreakingChange() bool
type ChangelogList ¶ added in v0.10.16
type ChangelogList []*Changelog
func (ChangelogList) Len ¶ added in v0.10.16
func (l ChangelogList) Len() int
func (ChangelogList) Less ¶ added in v0.10.16
func (l ChangelogList) Less(i, j int) bool
it is a bug to pass a changelog list containing a nil version to this function
func (ChangelogList) Swap ¶ added in v0.10.16
func (l ChangelogList) Swap(i, j int)
type ChangelogReader ¶
type ChangelogReader interface { GetChangelogForTag(ctx context.Context, tag string) (*Changelog, error) ReadChangelogFile(ctx context.Context, path string) (*ChangelogFile, error) }
func NewChangelogReader ¶
func NewChangelogReader(code vfsutils.MountedRepo) ChangelogReader
type ChangelogTmplData ¶ added in v0.10.16
type ChangelogValidator ¶
type ChangelogValidator interface { ShouldCheckChangelog(ctx context.Context) (bool, error) ValidateChangelog(ctx context.Context) (*ChangelogFile, error) }
func NewChangelogValidator ¶
func NewChangelogValidator(client githubutils.RepoClient, code vfsutils.MountedRepo, base string) ChangelogValidator
func NewChangelogValidatorWithLabelOrder ¶ added in v0.21.2
func NewChangelogValidatorWithLabelOrder(client githubutils.RepoClient, code vfsutils.MountedRepo, base string, labelOrder []string) ChangelogValidator
type TagComparator ¶ added in v0.21.2
type ValidationSettings ¶ added in v0.11.1
type ValidationSettings struct { // If true, then the validator will skip checks to enforce how version numbers are incremented, allowing for more flexible // versioning for new features or breaking changes RelaxSemverValidation bool `json:"relaxSemverValidation"` // If true, then the validator will require a changelog version with a label. // This is useful to enforce version schemes like we use for envoy-gloo / envoy-gloo-ee, which always have the form: // $ENVOY_VERSION-$PATCH_NUM RequireLabel bool `json:"requireLabel"` // If non-empty, then the validator will reject a changelog if the version's label is not contained in this slice AllowedLabels []string `json:"allowedLabels"` // defaults to "". When set, allows for a nested processing schema. ex: "v1.10" would mean only files in "changelog/v1.10" would be processed ActiveSubdirectory string `json:"activeSubdirectory"` }
func GetValidationSettings ¶ added in v0.11.8
func GetValidationSettings(ctx context.Context, code vfsutils.MountedRepo, client githubutils.RepoClient) (*ValidationSettings, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.