drone

package
v0.0.0-...-69a28d2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventPush   = "push"
	EventPull   = "pull_request"
	EventTag    = "tag"
	EventDeploy = "deployment"
)

Events

View Source
const (
	StatusSkipped = "skipped"
	StatusPending = "pending"
	StatusRunning = "running"
	StatusSuccess = "success"
	StatusFailure = "failure"
	StatusKilled  = "killed"
	StatusError   = "error"
)

Statuses

View Source
const (
	Freebsd_386 uint = iota
	Freebsd_amd64
	Freebsd_arm
	Linux_386
	Linux_amd64
	Linux_arm
	Linux_arm64
	Solaris_amd64
	Windows_386
	Windows_amd64
)

Architectures

Variables

View Source
var Archs = map[string]uint{
	"freebsd_386":   Freebsd_386,
	"freebsd_amd64": Freebsd_amd64,
	"freebsd_arm":   Freebsd_arm,
	"linux_386":     Linux_386,
	"linux_amd64":   Linux_amd64,
	"linux_arm":     Linux_arm,
	"linux_arm64":   Linux_arm64,
	"solaris_amd64": Solaris_amd64,
	"windows_386":   Windows_386,
	"windows_amd64": Windows_amd64,
}

Architecture Map

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Owner     string `json:"owner"`
	Name      string `json:"name"`
	FullName  string `json:"full_name"`
	Number    int    `json:"number"`
	Event     string `json:"event"`
	Status    string `json:"status"`
	Enqueued  int64  `json:"enqueued_at"`
	Created   int64  `json:"created_at"`
	Started   int64  `json:"started_at"`
	Finished  int64  `json:"finished_at"`
	Commit    string `json:"commit"`
	Branch    string `json:"branch"`
	Ref       string `json:"ref"`
	Refspec   string `json:"refspec"`
	Remote    string `json:"remote"`
	Title     string `json:"title"`
	Message   string `json:"message"`
	Timestamp int64  `json:"timestamp"`
	Author    string `json:"author"`
	Avatar    string `json:"author_avatar"`
	Email     string `json:"author_email"`
	Link      string `json:"link_url"`
}

Activity represents a build activity. It combines the build details with summary Repository information.

type Build

type Build struct {
	ID        int64  `json:"id"`
	Number    int    `json:"number"`
	Event     string `json:"event"`
	Status    string `json:"status"`
	Enqueued  int64  `json:"enqueued_at"`
	Created   int64  `json:"created_at"`
	Started   int64  `json:"started_at"`
	Finished  int64  `json:"finished_at"`
	Deploy    string `json:"deploy_to"`
	Commit    string `json:"commit"`
	Branch    string `json:"branch"`
	Ref       string `json:"ref"`
	Refspec   string `json:"refspec"`
	Remote    string `json:"remote"`
	Title     string `json:"title"`
	Message   string `json:"message"`
	Timestamp int64  `json:"timestamp"`
	Author    string `json:"author"`
	Avatar    string `json:"author_avatar"`
	Email     string `json:"author_email"`
	Link      string `json:"link_url"`
}

Build represents the process of compiling and testing a changeset, typically triggered by the remote system (ie GitHub).

type Client

type Client interface {
	// Self returns the currently authenticated user.
	Self() (*User, error)

	// User returns a user by login.
	User(string) (*User, error)

	// UserList returns a list of all registered users.
	UserList() ([]*User, error)

	// UserPost creates a new user account.
	UserPost(*User) (*User, error)

	// UserPatch updates a user account.
	UserPatch(*User) (*User, error)

	// UserDel deletes a user account.
	UserDel(string) error

	// UserFeed returns the user's activity feed.
	UserFeed() ([]*Activity, error)

	// Repo returns a repository by name.
	Repo(string, string) (*Repo, error)

	// RepoList returns a list of all repositories to which
	// the user has explicit access in the host system.
	RepoList() ([]*Repo, error)

	// RepoPost activates a repository.
	RepoPost(string, string) (*Repo, error)

	// RepoPatch updates a repository.
	RepoPatch(*Repo) (*Repo, error)

	// RepoDel deletes a repository.
	RepoDel(string, string) error

	// RepoKey returns a repository public key.
	RepoKey(string, string) (*Key, error)

	// Build returns a repository build by number.
	Build(string, string, int) (*Build, error)

	// BuildLast returns the latest repository build by branch.
	// An empty branch will result in the default branch.
	BuildLast(string, string, string) (*Build, error)

	// BuildList returns a list of recent builds for the
	// the specified repository.
	BuildList(string, string) ([]*Build, error)

	// BuildStart re-starts a stopped build.
	BuildStart(string, string, int) (*Build, error)

	// BuildStop stops the specified running job for given build.
	BuildStop(string, string, int, int) error

	// BuildFork re-starts a stopped build with a new build number,
	// preserving the prior history.
	BuildFork(string, string, int) (*Build, error)

	// BuildLogs returns the build logs for the specified job.
	BuildLogs(string, string, int, int) (io.ReadCloser, error)

	// Node returns a node by id.
	Node(int64) (*Node, error)

	// NodeList returns a list of all registered worker nodes.
	NodeList() ([]*Node, error)

	// NodePost registers a new worker node.
	NodePost(*Node) (*Node, error)

	// NodeDel deletes a worker node.
	NodeDel(int64) error
}

Client describes a drone client.

func NewClient

func NewClient(uri string) Client

NewClient returns a client at the specified url.

func NewClientToken

func NewClientToken(uri, token string) Client

NewClientToken returns a client at the specified url that authenticates all outbound requests with the given token.

type Job

type Job struct {
	ID       int64  `json:"id"`
	Number   int    `json:"number"`
	Status   string `json:"status"`
	ExitCode int    `json:"exit_code"`
	Enqueued int64  `json:"enqueued_at"`
	Started  int64  `json:"started_at"`
	Finished int64  `json:"finished_at"`

	Environment map[string]string `json:"environment"`
}

Job represents a single job that is being executed as part of a Build.

type Key

type Key struct {
	Public  string `json:"public"`
	Private string `json:"private"`
}

Key represents an RSA public and private key assigned to a repository. It may be used to clone private repositories, or as a deployment key.

type Netrc

type Netrc struct {
	Machine  string `json:"machine"`
	Login    string `json:"login"`
	Password string `json:"user"`
}

Netrc defines a default .netrc file that should be injected into the build environment. It will be used to authorize access to https resources, such as git+https clones.

type Node

type Node struct {
	ID   int64  `json:"id"`
	Addr string `json:"address"`
	Arch string `json:"architecture"`
	Cert string `json:"cert"`
	Key  string `json:"key"`
	CA   string `json:"ca"`
}

Node represents a local or remote Docker daemon that is responsible for running jobs.

type Payload

type Payload struct {
	Yaml      string      `json:"config"`
	YamlEnc   string      `json:"secret"`
	Repo      *Repo       `json:"repo"`
	Build     *Build      `json:"build"`
	BuildLast *Build      `json:"build_last"`
	Job       *Job        `json:"job"`
	Netrc     *Netrc      `json:"netrc"`
	Keys      *Key        `json:"keys"`
	System    *System     `json:"system"`
	Workspace *Workspace  `json:"workspace"`
	Vargs     interface{} `json:"vargs"`
}

Payload defines the full payload send to plugins.

type Repo

type Repo struct {
	ID          int64  `json:"id"`
	Owner       string `json:"owner"`
	Name        string `json:"name"`
	FullName    string `json:"full_name"`
	Avatar      string `json:"avatar_url"`
	Link        string `json:"link_url"`
	Clone       string `json:"clone_url"`
	Branch      string `json:"default_branch"`
	Timeout     int64  `json:"timeout"`
	IsPrivate   bool   `json:"private"`
	IsTrusted   bool   `json:"trusted"`
	AllowPull   bool   `json:"allow_pr"`
	AllowPush   bool   `json:"allow_push"`
	AllowDeploy bool   `json:"allow_deploys"`
	AllowTag    bool   `json:"allow_tags"`
}

Repo represents a version control repository.

type StringInt

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

StringInt representes a string or an integer value.

func (StringInt) String

func (e StringInt) String() string

func (*StringInt) UnmarshalJSON

func (e *StringInt) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals bytes into a StringInt.

type StringMap

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

StringMap representes a string or a map of strings.

func NewStringMap

func NewStringMap(parts map[string]string) StringMap

NewStringMap takes a map of string to string and returns a StringMap.

func (*StringMap) Len

func (e *StringMap) Len() int

Len returns the number of elements in the StringMap.

func (*StringMap) Map

func (e *StringMap) Map() map[string]string

Map returns StringMap as a map of string to string.

func (*StringMap) String

func (e *StringMap) String() (str string)

String satisfies the fmt.Stringer interface.

func (*StringMap) UnmarshalJSON

func (e *StringMap) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals bytes into a StringMap.

type StringSlice

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

StringSlice representes a string or an array of strings.

func NewStringSlice

func NewStringSlice(parts []string) StringSlice

NewStringSlice takes a slice of strings and returns a StringSlice.

func (*StringSlice) Len

func (e *StringSlice) Len() int

Len returns the number of strings in a StringSlice.

func (*StringSlice) Slice

func (e *StringSlice) Slice() []string

Slice returns the slice of strings in a StringSlice.

func (*StringSlice) UnmarshalJSON

func (e *StringSlice) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals bytes into a StringSlice.

type System

type System struct {
	Version   string   `json:"version"`
	Link      string   `json:"link_url"`
	Plugins   []string `json:"plugins"`
	Globals   []string `json:"globals"`
	Escalates []string `json:"privileged_plugins"`
}

System represents the drone system.

type User

type User struct {
	ID     int64  `json:"id"`
	Login  string `json:"login"`
	Email  string `json:"email"`
	Avatar string `json:"avatar_url"`
	Active bool   `json:"active"`
	Admin  bool   `json:"admin"`
}

User represents a user account.

type Workspace

type Workspace struct {
	Root string `json:"root"`
	Path string `json:"path"`

	Netrc *Netrc `json:"netrc"`
	Keys  *Key   `json:"keys"`
}

Workspace defines the build's workspace inside the container. This helps the plugin locate the source code directory.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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