plugin

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FlagsRepositoryCategory = "Woodpecker Repository Flags"
	FlagsPipelineCategory   = "Woodpecker Pipeline Flags"
	FlagsCommitCategory     = "Woodpecker Commit Flags"
	FlagsStepCategory       = "Woodpecker Step Flags"
	FlagsSystemCategory     = "Woodpecker System Flags"
	FlagsPluginCategory     = "Plugin Flags"
)
View Source
const (
	NetDailerTimeout                 = 30 * time.Second
	HTTPTransportIdleTimeout         = 90 * time.Second
	HTTPTransportTLSHandshakeTimeout = 10 * time.Second
	HTTPTransportMaxIdleConns        = 100
)

Variables

This section is empty.

Functions

func Flags

func Flags() []cli.Flag

Flags has the cli.Flags for the Woodpecker plugin.

func SetupConsoleLogger

func SetupConsoleLogger(c *cli.Context) error

SetupConsoleLogger sets up the console logger.

Types

type Author

type Author struct {
	Name   string
	Email  string
	Avatar string
}

Author defines runtime metadata for a commit author.

type Commit

type Commit struct {
	URL          string
	SHA          string
	Ref          string
	Refspec      string
	PullRequest  string
	SourceBranch string
	TargetBranch string
	Branch       string
	Tag          string
	Message      string
	Author       Author
}

Commit defines runtime metadata for a commit.

type ExecuteFunc

type ExecuteFunc func(ctx context.Context, cCtx *cli.Context) error

ExecuteFunc defines the function that is executed by the plugin.

type Metadata

type Metadata struct {
	Repository Repository
	Pipeline   Pipeline
	Curr       Commit
	Prev       Commit
	Step       Step
	System     System
}

Metadata defines runtime metadata.

func MetadataFromContext

func MetadataFromContext(ctx *cli.Context) Metadata

MetadataFromContext creates a Metadata from the cli.Context.

type Network added in v0.2.0

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.

func NetworkFromContext added in v0.2.0

func NetworkFromContext(ctx *cli.Context) Network

type Options

type Options struct {
	// Name of the plugin.
	Name string
	// Description of the plugin.
	Description string
	// Version of the plugin.
	Version string
	// Version metadata of the plugin.
	VersionMetadata string
	// Flags of the plugin.
	Flags []cli.Flag
	// Execute function of the plugin.
	Execute ExecuteFunc
}

Options defines the options for the plugin.

type Pipeline

type Pipeline struct {
	Number       int64
	Status       string
	Event        string
	URL          string
	DeployTarget string
	Created      time.Time
	Started      time.Time
	Finished     time.Time
	Parent       int64
}

Pipeline defines runtime metadata for a pipeline.

type Plugin

type Plugin struct {

	// Network options.
	Network Network
	// Metadata of the current pipeline.
	Metadata Metadata
	// contains filtered or unexported fields
}

Plugin defines the plugin instance.

func New

func New(opt Options) *Plugin

New plugin instance.

func (*Plugin) Run

func (p *Plugin) Run()

Run the plugin.

type Repository

type Repository struct {
	Slug     string
	Name     string
	Owner    string
	URL      string
	CloneURL string
	Private  bool
	Branch   string
	RemoteID int64
}

Repository defines runtime metadata for a repository.

type Step

type Step struct {
	Number   int
	Started  time.Time
	Finished time.Time
}

Step defines runtime metadata for a step.

type StringSliceFlag

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

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

func (*StringSliceFlag) Set

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

func (*StringSliceFlag) String

func (s *StringSliceFlag) String() string

type System

type System struct {
	Name     string
	Host     string
	URL      string
	Platform string
	Version  string
}

System defines runtime metadata for a ci/cd system.

Jump to

Keyboard shortcuts

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