scm

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfMissing = errors.New("Missing .ship-it file")
)
View Source
var ErrFileMissing = errors.New("File missing in repository")

Functions

This section is empty.

Types

type ChangelogConf added in v0.12.0

type ChangelogConf struct {
	Type string `yaml:"type,omitempty" validate:"oneof=legacy github"`
}

type Config

type Config struct {
	TargetBranch string        `yaml:"targetBranch" validate:"required"`
	Labels       LabelsConfig  `yaml:"labels,omitempty"`
	Strategy     StrategyConf  `yaml:"strategy,omitempty"`
	Changelog    ChangelogConf `yaml:"changelog,omitempty"`
}

type GithubClient

type GithubClient interface {
	CreateMilestone(ctx context.Context, title string) (*github.Milestone, error)
	AddPRtoMilestone(ctx context.Context, pull *github.PullRequest, milestone *github.Milestone) error
	GetReleaseByTag(ctx context.Context, tag string) (*github.RepositoryRelease, error)
	DeleteRelease(ctx context.Context, r *github.RepositoryRelease) error
	DeleteTag(ctx context.Context, tag string) error
	EditRelease(ctx context.Context, id int64, release *github.RepositoryRelease) (*github.RepositoryRelease, error)
	GetRef(ctx context.Context, r string) (*github.Reference, error)
	CreateRef(ctx context.Context, r *github.Reference) error
	CreateRelease(ctx context.Context, r *github.RepositoryRelease) error
	GetRefs(ctx context.Context, pattern string) ([]*github.Reference, error)
	GetCommitRange(ctx context.Context, base, head string) ([]*github.RepositoryCommit, error)
	GetPullsInCommitRange(ctx context.Context, commits []*github.RepositoryCommit) ([]*github.PullRequest, error)
	GetLatestTag(ctx context.Context) (tag string, ver *semver.Version, err error)
	GetFile(ctx context.Context, ref, file string) (io.ReadCloser, error)
	GenerateReleaseNotes(ctx context.Context, curr string) (*github.RepositoryReleaseNotes, error)
	GetRepo() Repo
}

type GithubClientImpl

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

func NewGithubClient

func NewGithubClient(tc *http.Client, repo Repo) *GithubClientImpl

func (*GithubClientImpl) AddPRtoMilestone

func (c *GithubClientImpl) AddPRtoMilestone(ctx context.Context, pull *github.PullRequest, milestone *github.Milestone) error

func (*GithubClientImpl) CreateMilestone

func (c *GithubClientImpl) CreateMilestone(ctx context.Context, title string) (*github.Milestone, error)

func (*GithubClientImpl) CreateRef

func (c *GithubClientImpl) CreateRef(ctx context.Context, r *github.Reference) error

func (*GithubClientImpl) CreateRelease

func (c *GithubClientImpl) CreateRelease(ctx context.Context, r *github.RepositoryRelease) error

func (*GithubClientImpl) DeleteRelease

func (c *GithubClientImpl) DeleteRelease(ctx context.Context, release *github.RepositoryRelease) error

func (*GithubClientImpl) DeleteTag

func (c *GithubClientImpl) DeleteTag(ctx context.Context, tag string) error

func (*GithubClientImpl) EditRelease

func (*GithubClientImpl) GenerateReleaseNotes added in v0.12.2

func (c *GithubClientImpl) GenerateReleaseNotes(ctx context.Context, curr string) (*github.RepositoryReleaseNotes, error)

func (*GithubClientImpl) GetCommitRange

func (c *GithubClientImpl) GetCommitRange(ctx context.Context, base, head string) ([]*github.RepositoryCommit, error)

func (*GithubClientImpl) GetFile

func (c *GithubClientImpl) GetFile(ctx context.Context, ref, file string) (io.ReadCloser, error)

func (*GithubClientImpl) GetLatestTag

func (c *GithubClientImpl) GetLatestTag(ctx context.Context) (tag string, ver *semver.Version, err error)

func (*GithubClientImpl) GetPullsInCommitRange

func (c *GithubClientImpl) GetPullsInCommitRange(ctx context.Context, commits []*github.RepositoryCommit) ([]*github.PullRequest, error)

func (*GithubClientImpl) GetRef

func (*GithubClientImpl) GetRefs

func (c *GithubClientImpl) GetRefs(ctx context.Context, pattern string) ([]*github.Reference, error)

func (*GithubClientImpl) GetReleaseByTag

func (c *GithubClientImpl) GetReleaseByTag(ctx context.Context, tag string) (*github.RepositoryRelease, error)

func (*GithubClientImpl) GetRepo

func (c *GithubClientImpl) GetRepo() Repo

type LabelsConfig

type LabelsConfig struct {
	Major string `yaml:"major,omitempty"`
	Minor string `yaml:"minor,omitempty"`
}

type Releaser

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

func NewReleaser

func NewReleaser(ctx context.Context, client GithubClient, ref string, log *logrus.Entry) (*Releaser, error)

func (*Releaser) CleanupCandidates

func (r *Releaser) CleanupCandidates(ctx context.Context, release *github.RepositoryRelease) (int, error)

func (*Releaser) CollectChangelog

func (r *Releaser) CollectChangelog(pulls []*github.PullRequest) (string, error)

func (*Releaser) FindPreviousRelease

func (r *Releaser) FindPreviousRelease(ctx context.Context, version *semver.Version) (*github.RepositoryRelease, error)

func (*Releaser) HandlePush

func (r *Releaser) HandlePush(ctx context.Context, e *github.PushEvent)

func (*Releaser) HandleRelease

func (r *Releaser) HandleRelease(ctx context.Context, e *github.ReleaseEvent)

func (*Releaser) Increment

func (r *Releaser) Increment(ctx context.Context, current *semver.Version, pulls []*github.PullRequest) (*semver.Version, error)

func (*Releaser) Match

func (r *Releaser) Match(ref string) bool

func (*Releaser) Promote

type Repo

type Repo interface {
	GetFullName() string
	GetOwner() *github.User
	GetName() string
	GetDefaultBranch() string
}

type StrategyConf

type StrategyConf struct {
	Type string `yaml:"type,omitempty" validate:"oneof=pre-release full-release"`
}

Jump to

Keyboard shortcuts

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