drone

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WritePluginArtifactFile

func WritePluginArtifactFile(registryType RegistryType, artifactFilePath, registryURL, imageName, digest string, tags []string) error

WritePluginArtifactFile writes the docker artifact data to the provided artifact file

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 int64

	// 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 int64

	// Parent build number for the build.
	Parent int64

	// Event that triggered the build.
	Event 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
}

Build represents a build of a repository.

type Commit

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

	// Before contains the commit sha before the patch is applied.
	Before 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 Data

type Data struct {
	RegistryType RegistryType `json:"registryType"`
	RegistryURL  string       `json:"registryUrl"`
	Images       []Image      `json:"images"`
}

Data stores the registry data

type DockerArtifact

type DockerArtifact struct {
	Kind string `json:"kind"`
	Data Data   `json:"data"`
}

DockerArtifact is the current artifact

type Image

type Image struct {
	Image  string `json:"image"`
	Digest string `json:"digest"`
}

Image stores the image data

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.
	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
	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 RegistryType

type RegistryType string

RegistryType is the type of registry

const (
	Docker RegistryType = "Docker"
	ECR    RegistryType = "ECR"
	GCR    RegistryType = "GCR"
	ACR    RegistryType = "ACR"
	GAR    RegistryType = "GAR"
)

Registries const

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

	// 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 {
	// Name is the name for the current running build stage.
	Name 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
}

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 int64
}

Step represents the currently running step within the stage.

func (Step) String

func (s Step) String() string

type System

type System struct {
	// 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