context

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 7 Imported by: 20

Documentation

Overview

Package context provides gorelease context which is passed through the pipeline.

The context extends the standard library context and add a few more fields and other things, so pipes can gather data provided by previous pipes without really knowing each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	stdctx.Context
	Config             config.Project
	Env                Env
	SkipTokenCheck     bool
	Token              string
	TokenType          TokenType
	Git                GitInfo
	Date               time.Time
	Artifacts          artifact.Artifacts
	ReleaseURL         string
	ReleaseNotes       string
	ReleaseNotesFile   string
	ReleaseNotesTmpl   string
	ReleaseHeaderFile  string
	ReleaseHeaderTmpl  string
	ReleaseFooterFile  string
	ReleaseFooterTmpl  string
	Version            string
	ModulePath         string
	Snapshot           bool
	SkipPostBuildHooks bool
	SkipPublish        bool
	SkipAnnounce       bool
	SkipSign           bool
	SkipValidate       bool
	SkipSBOMCataloging bool
	SkipDocker         bool
	SkipBefore         bool
	RmDist             bool
	PreRelease         bool
	Deprecated         bool
	Parallelism        int
	Semver             Semver
	Runtime            Runtime
}

Context carries along some data through the pipes.

func New

func New(config config.Project) *Context

New context.

func NewWithTimeout

func NewWithTimeout(config config.Project, timeout time.Duration) (*Context, stdctx.CancelFunc)

NewWithTimeout new context with the given timeout.

func Wrap

func Wrap(ctx stdctx.Context, config config.Project) *Context

Wrap wraps an existing context.

type Env added in v0.104.2

type Env map[string]string

Env is the environment variables.

func ToEnv added in v1.0.0

func ToEnv(env []string) Env

ToEnv converts a list of strings to an Env (aka a map[string]string).

func (Env) Copy added in v0.125.0

func (e Env) Copy() Env

Copy returns a copy of the environment.

func (Env) Strings added in v0.104.2

func (e Env) Strings() []string

Strings returns the current environment as a list of strings, suitable for os executions.

type GitInfo

type GitInfo struct {
	Branch      string
	CurrentTag  string
	PreviousTag string
	Commit      string
	ShortCommit string
	FullCommit  string
	CommitDate  time.Time
	URL         string
	Summary     string
	TagSubject  string
	TagContents string
	TagBody     string
}

GitInfo includes tags and diffs used in some point.

type Runtime added in v1.5.0

type Runtime struct {
	Goos   string
	Goarch string
}

type Semver added in v0.98.0

type Semver struct {
	Major      uint64
	Minor      uint64
	Patch      uint64
	RawVersion string
	Prerelease string
}

Semver represents a semantic version.

type TokenType added in v0.116.0

type TokenType string

TokenType is either github or gitlab.

const (
	// TokenTypeGitHub defines github as type of the token.
	TokenTypeGitHub TokenType = "github"
	// TokenTypeGitLab defines gitlab as type of the token.
	TokenTypeGitLab TokenType = "gitlab"
	// TokenTypeGitea defines gitea as type of the token.
	TokenTypeGitea TokenType = "gitea"
)

Jump to

Keyboard shortcuts

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