drone

package
v2.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	// Username of the Commit author.
	Username string
	// Name of the Commit author.
	Name string
	// Email for the Commit author.
	Email string
	// Avatar for the Commit author.
	Avatar string
}

Author of a Commit.

func (Author) String

func (a Author) String() string

type Build

type Build struct {
	// Branch defines the branch name of the build.
	Branch string

	// PullRequest number of the build.
	PullRequest int

	// Tag of the build.
	Tag string

	// SourceBranch for the pull request.
	SourceBranch string

	// TargetBranch for the pull request.
	TargetBranch string

	// Number for the build.
	Number int

	// Parent build number for the build.
	Parent int

	// Event that triggered the build.
	Event string

	// Action that triggered the build. This value is used to differentiate
	// bettween a pull request being opened vs synchronized.
	Action string

	// Status of the build.
	Status string

	// Link to the build.
	Link string

	// Created time of the build.
	Created time.Time

	// Started time of the build.
	Started time.Time

	// Finished time of the build.
	Finished time.Time

	// DeployTo the environment.
	DeployTo string

	// DeployID for the environment.
	DeployID int

	// FailedStages of the build.
	FailedStages []string

	// FailedSteps of the build.
	FailedSteps []string
}

Build represents a build of a repository.

type CalVer

type CalVer struct {
	// Version is the full calendar version.
	Version string

	// Major is the major version.
	Major string

	// Minor is the minor version.
	Minor string

	// Micro is the micro version.
	Micro string

	// Modifier is a modifier for the version.
	Modifier string

	// Short is the short version.
	//
	// This does not include the modifier.
	Short string
}

CalVer represents the calendar version of the currently running build.

This value is only applicable for tags. If the tag cannot be parsed into a calendar version then the value will be empty.

func (CalVer) String

func (c CalVer) String() string

type Commit

type Commit struct {
	// SHA for the current commit.
	SHA string

	// Before contains the commit sha before the patch is applied.
	Before string

	// After contains the commit sha after the patch is applied.
	After string

	// Ref for the current commit.
	Ref string

	// Branch target for the push or pull request. This may be empty for
	// tag events.
	Branch string

	// Link to the commit or object in the source control management system.
	Link string

	// Message for the current commit.
	Message Message

	// Author of the commit.
	Author Author
}

Commit represents the current commit being built.

func (Commit) String

func (c Commit) String() string

type Message

type Message struct {
	// Title for the Commit.
	Title string
	// Body of the Commit message.
	Body string
}

Message for a Commit.

func ParseMessage

func ParseMessage(msg string) Message

ParseMessage takes a full commit message and translates it into a Message.

func (Message) String

func (m Message) String() string

type Network

type Network struct {
	// Context for making network requests.
	//
	// If `trace` logging is requested the context will use `httptrace` to
	// capture all network requests.
	//nolint:containedctx
	Context context.Context

	/// Whether SSL verification is skipped
	SkipVerify bool

	// Client for making network requests.
	Client *http.Client
}

Network contains options for connecting to the network.

type Pipeline

type Pipeline struct {
	Build  Build
	Repo   Repo
	Commit Commit
	Stage  Stage
	Step   Step
	SemVer SemVer
	CalVer CalVer
	System System
}

Pipeline being executed.

Represents the full Drone environment that the plugin is executing in.

type Plugin

type Plugin interface {
	// Validate checks the inputs to the Plugin and verifies that the
	// configuration is correct before executing.
	//
	// An error is returned if there are any issues with the current
	// configuration, such as missing information or files not being
	// present. A Plugin may choose to populate additional information to
	// ensure a successful execution, for example if a URL is parsed
	// successfully it can be stored off for later use.
	//
	// Validate needs to be called before Execute.
	Validate() error

	// Execute runs the plugin in the current configuration.
	//
	// An error is returned if the Plugin did not run successfully that
	// describes the runtime error.
	//
	// Execute needs to be called after Validate.
	Execute() error
}

Plugin is an interface for a Drone plugin written in Go.

This is a higly opinionated interface for what a Plugin should do. Its not required that a plugin author follow it.

type Repo

type Repo struct {
	// Slug for the full name of a repo.
	Slug string

	// SCM for the used SCM.
	SCM string

	// Owner for the repo owner.
	Owner string

	// Name for the repo name.
	Name string

	// Link for the link to the repo.
	Link string

	// Branch for the default branch of the repo.
	Branch string

	// HTTPURL for the clone URL via HTTP.
	HTTPURL string

	// SSHURL for the clone URL via SSH
	SSHURL string

	// Visbility for the visbility of the repo.
	Visibility string

	// Private to show if the repo is private.
	Private bool
}

Repo represents the repository for the build.

func (Repo) String

func (r Repo) String() string

type SemVer

type SemVer struct {
	// Version is the full semantic version.
	Version string

	// Major version number.
	Major string

	// Minor version number.
	Minor string

	// Patch version number.
	Patch string

	// Prerelease version.
	Prerelease string

	// Build version number.
	//
	// This is signified by a + at the end of the tag.
	Build string

	// Short version of the semantic version string where labels and
	// metadata are truncated.
	Short string

	// Error is the semantic version parsing error if the tag was invalid.
	Error string
}

SemVer represents the semantic version of the currently running build.

This value is only applicable for tags. If the tag cannot be parsed into a semantic version then SemVer.Error will have the reason.

func (SemVer) String

func (s SemVer) String() string

type Stage

type Stage struct {
	// Kind is the kind of resource being executed.
	//
	// This value is sourced from the `kind` attribute in the yaml
	// configuration file
	Kind string

	// Type is the type of resource being executed.
	Type string

	// Name is the name for the current running build stage.
	Name string

	// Number is the stage number for the current running build stage.
	Number int

	// Machine provides the name of the host machine on which the build
	// stage is currently running.
	Machine string

	// OS is the target operating system for the current build stage.
	OS string

	// Arch is the platform architecture of the current build stage.
	Arch string

	// Variant is the target architecture variant for the current build
	// stage.
	Variant string

	// Version is OS version for the current build stage.
	Version string

	// Status is the status for the current running build stage.
	//
	// If all of the stage's steps are passing, the status defaults to
	// success.
	Status string

	// Started is the unix timestamp for when a build stage was started by
	// the runner.
	Started time.Time

	// Finished is the unix timestamp for when the pipeline is finished.
	//
	// A running pipleine cannot have a finish timestamp, therefore, the
	// system aways sets this value to the current timestamp.
	Finished time.Time

	// DependsOn is a list of dependencies for the current build stage.
	DependsOn []string
}

Stage represents a build stage.

func (Stage) String

func (s Stage) String() string

type Step

type Step struct {
	// Name for the name of the current step.
	Name string

	// Number is the numeric value of the step.
	Number int
}

Step represents the currently running step within the stage.

func (Step) String

func (s Step) String() string

type StringSliceFlag added in v2.2.0

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

StringSliceFlag is a flag type which support comma separated values and escaping to not split at unwanted lines.

func (*StringSliceFlag) Get added in v2.2.0

func (s *StringSliceFlag) Get() []string

func (*StringSliceFlag) Set added in v2.2.0

func (s *StringSliceFlag) Set(value string) error

func (*StringSliceFlag) String added in v2.2.0

func (s *StringSliceFlag) String() string

type System

type System struct {
	// Proto for the system protocol.
	Proto string

	// Host for the system host name.
	Host string

	// Version for the system version.
	Version string
}

System represents the available system variables.

func (System) String

func (s System) String() string

Jump to

Keyboard shortcuts

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