notes

package
v0.17.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 37 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultOrg  = "kubernetes"
	DefaultRepo = "kubernetes"
)

Variables

This section is empty.

Functions

func MatchesExcludeFilter added in v0.3.1

func MatchesExcludeFilter(msg string) bool

MatchesExcludeFilter returns true if the string matches an excluded release note.

func ParseReleaseNotesMap added in v0.4.0

func ParseReleaseNotesMap(mapPath string) (*[]ReleaseNotesMap, error)

ParseReleaseNotesMap Parses a Release Notes Map.

Types

type Dependencies added in v0.3.2

type Dependencies struct {
	// contains filtered or unexported fields
}

func NewDependencies added in v0.3.2

func NewDependencies() *Dependencies

func (*Dependencies) Changes added in v0.3.2

func (d *Dependencies) Changes(from, to string) (string, error)

Changes collects the dependency change report as markdown between both provided revisions. The function errors if anything went wrong.

func (*Dependencies) ChangesForURL added in v0.3.2

func (d *Dependencies) ChangesForURL(url, from, to string) (string, error)

Changes collects the dependency change report as markdown between both provided revisions for the specified repository URL. The function errors if anything went wrong.

func (*Dependencies) SetMoDiff added in v0.3.2

func (d *Dependencies) SetMoDiff(moDiff MoDiff)

SetMoDiff can be used to set the internal MoDiff implementation.

type DirectoryMapProvider added in v0.4.0

type DirectoryMapProvider struct {
	Path string
	Maps map[int][]*ReleaseNotesMap
}

DirectoryMapProvider is a provider that gets maps from a directory.

func (*DirectoryMapProvider) GetMapsForPR added in v0.4.0

func (mp *DirectoryMapProvider) GetMapsForPR(pr int) (notesMap []*ReleaseNotesMap, err error)

GetMapsForPR get the release notes maps for a specific PR number.

type DocType

type DocType string
const (
	DocTypeExternal DocType = "external"
	DocTypeKEP      DocType = "KEP"
	DocTypeOfficial DocType = "official"
)

type Documentation

type Documentation struct {
	// A description about the documentation
	Description string `json:"description,omitempty"`

	// The url to be linked
	URL string `json:"url"`

	// Classifies the link as something special, like a KEP
	Type DocType `json:"type"`
}

func DocumentationFromString

func DocumentationFromString(s string) []*Documentation

type Gatherer added in v0.2.1

type Gatherer struct {
	MapProviders []*MapProvider
	// contains filtered or unexported fields
}

func NewGatherer added in v0.2.2

func NewGatherer(ctx context.Context, opts *options.Options) (*Gatherer, error)

NewGatherer creates a new notes gatherer.

func NewGathererWithClient added in v0.2.2

func NewGathererWithClient(ctx context.Context, c github.Client) *Gatherer

NewGathererWithClient creates a new notes gatherer with a specific client.

func (*Gatherer) ListReleaseNotes added in v0.2.1

func (g *Gatherer) ListReleaseNotes() (*ReleaseNotes, error)

ListReleaseNotes produces a list of fully contextualized release notes starting from a given commit SHA and ending at starting a given commit SHA.

func (*Gatherer) ListReleaseNotesV2 added in v0.8.0

func (g *Gatherer) ListReleaseNotesV2() (*ReleaseNotes, error)

func (*Gatherer) ReleaseNoteForPullRequest added in v0.16.5

func (g *Gatherer) ReleaseNoteForPullRequest(prNr int) (*ReleaseNote, error)

ReleaseNoteForPullRequest returns a release note from a pull request number. If the release note is blank or.

func (*Gatherer) ReleaseNoteFromCommit added in v0.2.1

func (g *Gatherer) ReleaseNoteFromCommit(result *Result) (*ReleaseNote, error)

ReleaseNoteFromCommit produces a full contextualized release note given a GitHub commit API resource.

type Kind added in v0.4.0

type Kind string
const (
	KindAPIChange     Kind = "api-change"
	KindBug           Kind = "bug"
	KindCleanup       Kind = "cleanup"
	KindDeprecation   Kind = "deprecation"
	KindDesign        Kind = "design"
	KindDocumentation Kind = "documentation"
	KindFailingTest   Kind = "failing-test"
	KindFeature       Kind = "feature"
	KindFlake         Kind = "flake"
	KindRegression    Kind = "regression"
	KindOther         Kind = "Other (Cleanup or Flake)"
	KindUncategorized Kind = "Uncategorized"
)

type MapProvider added in v0.4.0

type MapProvider interface {
	GetMapsForPR(int) ([]*ReleaseNotesMap, error)
}

MapProvider interface that obtains release notes maps from a source.

func NewProviderFromInitString added in v0.4.0

func NewProviderFromInitString(initString string) (MapProvider, error)

NewProviderFromInitString creates a new map provider from an initialization string.

type MoDiff added in v0.3.2

type MoDiff interface {
	Run(*modiff.Config) (string, error)
}

type Notes added in v0.4.0

type Notes []string

type ReleaseNote

type ReleaseNote struct {
	// Commit is the SHA of the commit which is the source of this note. This is
	// also effectively a unique ID for release notes.
	Commit string `json:"commit"`

	// Text is the actual content of the release note
	Text string `json:"text"`

	// Markdown is the markdown formatted note
	Markdown string `json:"markdown"`

	// Docs is additional documentation for the release note
	Documentation []*Documentation `json:"documentation,omitempty"`

	// Author is the GitHub username of the commit author
	Author string `json:"author"`

	// AuthorURL is the GitHub URL of the commit author
	AuthorURL string `json:"author_url"`

	// PrURL is a URL to the PR
	PrURL string `json:"pr_url"`

	// PrNumber is the number of the PR
	PrNumber int `json:"pr_number"`

	// Areas is a list of the labels beginning with area/
	Areas []string `json:"areas,omitempty"`

	// Kinds is a list of the labels beginning with kind/
	Kinds []string `json:"kinds,omitempty"`

	// SIGs is a list of the labels beginning with sig/
	SIGs []string `json:"sigs,omitempty"`

	// Indicates whether or not a note will appear as a new feature
	Feature bool `json:"feature,omitempty"`

	// Indicates whether or not a note is duplicated across SIGs
	Duplicate bool `json:"duplicate,omitempty"`

	// Indicates whether or not a note is duplicated across Kinds
	DuplicateKind bool `json:"duplicate_kind,omitempty"`

	// ActionRequired indicates whether or not the release-note-action-required
	// label was set on the PR
	ActionRequired bool `json:"action_required,omitempty"`

	// DoNotPublish by default represents release-note-none label on GitHub
	DoNotPublish bool `json:"do_not_publish,omitempty"`

	// DataFields a key indexed map of data fields
	DataFields map[string]ReleaseNotesDataField `json:"-"`

	// IsMapped is set if the note got modified from a map
	IsMapped bool `json:"is_mapped,omitempty"`

	// PRBody is the full PR body of the release note
	PRBody string `json:"pr_body,omitempty"`
}

ReleaseNote is the type that represents the total sum of all the information we've gathered about a single release note.

func (*ReleaseNote) ApplyMap added in v0.4.0

func (rn *ReleaseNote) ApplyMap(noteMap *ReleaseNotesMap, markdownLinks bool) error

ApplyMap Modifies the content of the release using information from

a ReleaseNotesMap

func (*ReleaseNote) ContentHash added in v0.4.1

func (rn *ReleaseNote) ContentHash() (string, error)

ContentHash returns a sha1 hash derived from the note's content.

func (*ReleaseNote) ToNoteMap added in v0.4.1

func (rn *ReleaseNote) ToNoteMap() (string, error)

ToNoteMap returns the note's content as YAML code for use in a notemap.

type ReleaseNotes added in v0.2.0

type ReleaseNotes struct {
	// contains filtered or unexported fields
}

ReleaseNotes is the main struct for collecting release notes.

func GatherReleaseNotes added in v0.3.1

func GatherReleaseNotes(opts *options.Options) (*ReleaseNotes, error)

GatherReleaseNotes creates a new gatherer and collects the release notes afterwards.

func NewReleaseNotes added in v0.4.0

func NewReleaseNotes() *ReleaseNotes

NewReleaseNotes can be used to create a new empty ReleaseNotes struct.

func (*ReleaseNotes) ByPR added in v0.4.0

func (r *ReleaseNotes) ByPR() ReleaseNotesByPR

ByPR returns the ReleaseNotesByPR for the ReleaseNotes.

func (*ReleaseNotes) Get added in v0.4.0

func (r *ReleaseNotes) Get(prNumber int) *ReleaseNote

Get returns the ReleaseNote for the provided prNumber.

func (*ReleaseNotes) History added in v0.4.0

func (r *ReleaseNotes) History() ReleaseNotesHistory

History returns the ReleaseNotesHistory for the ReleaseNotes.

func (*ReleaseNotes) Set added in v0.4.0

func (r *ReleaseNotes) Set(prNumber int, note *ReleaseNote)

Set can be used to set a release note for the provided prNumber.

type ReleaseNotesByPR added in v0.4.0

type ReleaseNotesByPR map[int]*ReleaseNote

ReleaseNotes is a map of PR numbers referencing notes. To avoid needless loops, we need to be able to reference things by PR When we have to merge old and new entries, we want to be able to override the old entries with the new ones efficiently.

type ReleaseNotesDataField added in v0.4.0

type ReleaseNotesDataField interface{}

ReleaseNotesDataField extra data added to a release note.

type ReleaseNotesHistory added in v0.2.0

type ReleaseNotesHistory []int

ReleaseNotesHistory is the sorted list of PRs in the commit history.

type ReleaseNotesMap added in v0.4.0

type ReleaseNotesMap struct {
	// Pull request where the note was published
	PR int `json:"pr"`
	// SHA of the notes commit
	Commit      string `json:"commit,omitempty" yaml:"commit,omitempty"`
	ReleaseNote struct {
		// Text is the actual content of the release note
		Text *string `json:"text,omitempty" yaml:"text,omitempty"`

		// Docs is additional documentation for the release note
		Documentation *[]*Documentation `json:"documentation,omitempty" yaml:"documentation,omitempty"`

		// Author is the GitHub username of the commit author
		Author *string `json:"author,omitempty" yaml:"author,omitempty"`

		// Areas is a list of the labels beginning with area/
		Areas *[]string `json:"areas,omitempty" yaml:"areas,omitempty"`

		// Kinds is a list of the labels beginning with kind/
		Kinds *[]string `json:"kinds,omitempty" yaml:"kinds,omitempty"`

		// SIGs is a list of the labels beginning with sig/
		SIGs *[]string `json:"sigs,omitempty" yaml:"sigs,omitempty"`

		// Indicates whether or not a note will appear as a new feature
		Feature *bool `json:"feature,omitempty" yaml:"feature,omitempty"`

		// ActionRequired indicates whether or not the release-note-action-required
		// label was set on the PR
		ActionRequired *bool `json:"action_required,omitempty" yaml:"action_required,omitempty"`

		// DoNotPublish by default represents release-note-none label on GitHub
		DoNotPublish *bool `json:"do_not_publish,omitempty" yaml:"do_not_publish,omitempty"`
	} `json:"releasenote"`

	DataFields map[string]ReleaseNotesDataField `json:"datafields,omitempty" yaml:"datafields,omitempty"`

	// PRBody is the full original PR body.
	PRBody *string `json:"pr_body,omitempty" yaml:"pr_body,omitempty"`
}

ReleaseNotesMap holds the changes that will be applied to the notes the struct has double annotation because of this: https://play.golang.org/p/C7QM1varozy

type Result added in v0.2.0

type Result struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL