yaml

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 10 Imported by: 19

Documentation

Index

Constants

View Source
const (
	KindCron      = "cron"
	KindPipeline  = "pipeline"
	KindRegistry  = "registry"
	KindSecret    = "secret"
	KindSignature = "signature"
)

Resource enums.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	Args       map[string]string `json:"args,omitempty"`
	CacheFrom  []string          `json:"cache_from,omitempty" yaml:"cache_from"`
	Context    string            `json:"context,omitempty"`
	Dockerfile string            `json:"dockerfile,omitempty"`
	Image      string            `json:"image,omitempty"`
	Labels     map[string]string `json:"labels,omitempty"`
}

Build configures a Docker build.

func (*Build) UnmarshalYAML

func (b *Build) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshalling.

type BytesSize

type BytesSize int64

BytesSize stores a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB").

func (BytesSize) String

func (b BytesSize) String() string

String returns a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB").

func (*BytesSize) UnmarshalYAML

func (b *BytesSize) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshalling.

type Clone

type Clone struct {
	Disable    bool `json:"disable,omitempty"`
	Depth      int  `json:"depth,omitempty"`
	SkipVerify bool `json:"skip_verify,omitempty" yaml:"skip_verify"`
}

Clone configures the git clone.

type Concurrency

type Concurrency struct {
	Limit int `json:"limit,omitempty"`
}

Concurrency limits pipeline concurrency.

type Condition

type Condition struct {
	Include []string `yaml:"include,omitempty" json:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
}

Condition defines a runtime condition.

func (*Condition) Excludes

func (c *Condition) Excludes(v string) bool

Excludes returns true if the string matches the exclude patterns.

func (*Condition) Includes

func (c *Condition) Includes(v string) bool

Includes returns true if the string matches the include patterns.

func (*Condition) Match

func (c *Condition) Match(v string) bool

Match returns true if the string matches the include patterns and does not match any of the exclude patterns.

func (*Condition) UnmarshalYAML

func (c *Condition) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yml unmarshalling.

type Conditions

type Conditions struct {
	Action   Condition         `json:"action,omitempty"`
	Cron     Condition         `json:"cron,omitempty"`
	Ref      Condition         `json:"ref,omitempty"`
	Repo     Condition         `json:"repo,omitempty"`
	Instance Condition         `json:"instance,omitempty"`
	Target   Condition         `json:"target,omitempty"`
	Event    Condition         `json:"event,omitempty"`
	Branch   Condition         `json:"branch,omitempty"`
	Status   Condition         `json:"status,omitempty"`
	Paths    Condition         `json:"paths,omitempty"`
	Matrix   map[string]string `json:"matrix,omitempty"`
}

Conditions defines a group of conditions.

type Container

type Container struct {
	Build       *Build                `json:"build,omitempty"`
	Command     []string              `json:"command,omitempty"`
	Commands    []string              `json:"commands,omitempty"`
	Detach      bool                  `json:"detach,omitempty"`
	DependsOn   []string              `json:"depends_on,omitempty" yaml:"depends_on"`
	Devices     []*VolumeDevice       `json:"devices,omitempty"`
	DNS         []string              `json:"dns,omitempty"`
	DNSSearch   []string              `json:"dns_search,omitempty" yaml:"dns_search"`
	Entrypoint  []string              `json:"entrypoint,omitempty"`
	Environment map[string]*Variable  `json:"environment,omitempty"`
	ExtraHosts  []string              `json:"extra_hosts,omitempty" yaml:"extra_hosts"`
	Failure     string                `json:"failure,omitempty"`
	Image       string                `json:"image,omitempty"`
	Network     string                `json:"network_mode,omitempty" yaml:"network_mode"`
	Name        string                `json:"name,omitempty"`
	Ports       []*Port               `json:"ports,omitempty"`
	Privileged  bool                  `json:"privileged,omitempty"`
	Pull        string                `json:"pull,omitempty"`
	Push        *Push                 `json:"push,omitempty"`
	Resources   *Resources            `json:"resources,omitempty"`
	Settings    map[string]*Parameter `json:"settings,omitempty"`
	Shell       string                `json:"shell,omitempty"`
	User        string                `json:"user,omitempty"`
	Volumes     []*VolumeMount        `json:"volumes,omitempty"`
	When        Conditions            `json:"when,omitempty"`
	WorkingDir  string                `json:"working_dir,omitempty" yaml:"working_dir"`
}

Container defines a Docker container configuration.

type Cron

type Cron struct {
	Version string `json:"version,omitempty"`
	Kind    string `json:"kind,omitempty"`
	Type    string `json:"type,omitempty"`
	Name    string `json:"name,omitempty"`

	Spec CronSpec `json:"spec,omitempty"`
}

Cron is a resource that defines a cron job, used to execute pipelines at scheduled intervals.

func (*Cron) GetKind

func (c *Cron) GetKind() string

GetKind returns the resource kind.

func (*Cron) GetVersion

func (c *Cron) GetVersion() string

GetVersion returns the resource version.

func (Cron) Validate

func (c Cron) Validate() error

Validate returns an error if the cron is invalid.

type CronDeployment

type CronDeployment struct {
	Target string `json:"target,omitempty"`
}

CronDeployment defines a cron job deployment.

type CronSpec

type CronSpec struct {
	Schedule string         `json:"schedule,omitempty"`
	Branch   string         `json:"branch,omitempty"`
	Deploy   CronDeployment `json:"deployment,omitempty" yaml:"deployment"`
}

CronSpec defines the cron job.

type ExternalData

type ExternalData struct {
	Path string `json:"path,omitempty"`
	Name string `json:"name,omitempty"`
}

ExternalData defines the path and name of external data located in an external or remote storage system.

type Manifest

type Manifest struct {
	Resources []Resource
}

Manifest is a collection of Drone resources.

func Parse

func Parse(r io.Reader) (*Manifest, error)

Parse parses the configuration from io.Reader r.

func ParseBytes

func ParseBytes(b []byte) (*Manifest, error)

ParseBytes parses the configuration from bytes b.

func ParseFile

func ParseFile(p string) (*Manifest, error)

ParseFile parses the configuration from path p.

func ParseString

func ParseString(s string) (*Manifest, error)

ParseString parses the configuration from string s.

func (*Manifest) Encode

func (m *Manifest) Encode() ([]byte, error)

Encode encodes the manifest in Yaml format.

func (*Manifest) MarshalJSON

func (m *Manifest) MarshalJSON() ([]byte, error)

MarshalJSON implement the json.Marshaler.

func (*Manifest) MarshalYAML

func (m *Manifest) MarshalYAML() (interface{}, error)

MarshalYAML is not implemented and returns an error. This is because the Manifest is a representation of multiple yaml documents, and MarshalYAML would otherwise attempt to marshal as a single Yaml document. Use the Encode method instead.

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(b []byte) error

UnmarshalJSON implement the json.Unmarshaler.

type Parameter

type Parameter struct {
	Value  interface{} `json:"value,omitempty"`
	Secret string      `json:"from_secret,omitempty" yaml:"from_secret"`
}

Parameter represents an configuration parameter that can be defined as a literal or as a reference to a secret.

func (*Parameter) MarshalYAML added in v1.0.9

func (p *Parameter) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml marshalling.

func (*Parameter) UnmarshalYAML

func (p *Parameter) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshalling.

type Pipeline

type Pipeline struct {
	Version string `json:"version,omitempty"`
	Kind    string `json:"kind,omitempty"`
	Type    string `json:"type,omitempty"`
	Name    string `json:"name,omitempty"`

	Clone       Clone             `json:"clone,omitempty"`
	Concurrency Concurrency       `json:"concurrency,omitempty"`
	DependsOn   []string          `json:"depends_on,omitempty" yaml:"depends_on" `
	Node        map[string]string `json:"node,omitempty" yaml:"node"`
	Platform    Platform          `json:"platform,omitempty"`
	PullSecrets []string          `json:"image_pull_secrets,omitempty" yaml:"image_pull_secrets"`
	Services    []*Container      `json:"services,omitempty"`
	Steps       []*Container      `json:"steps,omitempty"`
	Trigger     Conditions        `json:"trigger,omitempty"`
	Volumes     []*Volume         `json:"volumes,omitempty"`
	Workspace   Workspace         `json:"workspace,omitempty"`
}

Pipeline is a resource that defines a continuous delivery pipeline.

func (*Pipeline) GetKind

func (p *Pipeline) GetKind() string

GetKind returns the resource kind.

func (*Pipeline) GetVersion

func (p *Pipeline) GetVersion() string

GetVersion returns the resource version.

type Platform

type Platform struct {
	OS      string `json:"os,omitempty"`
	Arch    string `json:"arch,omitempty"`
	Variant string `json:"variant,omitempty"`
	Version string `json:"version,omitempty"`
}

Platform defines the target platform.

type Port

type Port struct {
	Port     int    `json:"port,omitempty"`
	Host     int    `json:"host,omitempty"`
	Protocol string `json:"protocol,omitempty"`
}

Port represents a network port in a single container.

func (*Port) UnmarshalYAML

func (p *Port) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshalling.

type Push

type Push struct {
	Image string `json:"image,omitempty"`
}

Push configures a Docker push.

func (*Push) UnmarshalYAML

func (p *Push) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshalling.

type RawResource

type RawResource struct {
	Version string
	Kind    string
	Type    string
	Data    []byte `yaml:"-"`
}

RawResource is a raw encoded resource with the resource kind and type extracted.

func ParseRaw

func ParseRaw(r io.Reader) ([]*RawResource, error)

ParseRaw parses the multi-document yaml from the io.Reader and returns a slice of raw resources.

func ParseRawBytes

func ParseRawBytes(b []byte) ([]*RawResource, error)

ParseRawBytes parses the multi-document yaml from b and returns a slice of raw resources.

func ParseRawFile

func ParseRawFile(p string) ([]*RawResource, error)

ParseRawFile parses the multi-document yaml from path p and returns a slice of raw resources.

func ParseRawString

func ParseRawString(s string) ([]*RawResource, error)

ParseRawString parses the multi-document yaml from s and returns a slice of raw resources.

type Registry

type Registry struct {
	Version string `json:"version,omitempt"`
	Kind    string `json:"kind,omitempty"`
	Type    string `json:"type,omitempty"`

	Data map[string]string `json:"data,omitempty"`
}

Registry is a resource that provides encrypted registry credentials and pointers to external registry credentials (e.g. from vault).

func (*Registry) GetKind

func (r *Registry) GetKind() string

GetKind returns the resource kind.

func (*Registry) GetVersion

func (r *Registry) GetVersion() string

GetVersion returns the resource version.

func (*Registry) Validate

func (r *Registry) Validate() error

Validate returns an error if the registry is invalid.

type Resource

type Resource interface {
	// GetVersion returns the resource version.
	GetVersion() string

	// GetKind returns the resource kind.
	GetKind() string
}

Resource represents a Drone resource.

type ResourceObject

type ResourceObject struct {
	CPU    float64   `json:"cpu" yaml:"cpu"`
	Memory BytesSize `json:"memory"`
}

ResourceObject describes compute resource requirements.

type Resources

type Resources struct {
	// Limits describes the maximum amount of compute
	// resources allowed.
	Limits *ResourceObject `json:"limits,omitempty"`

	// Requests describes the minimum amount of
	// compute resources required.
	Requests *ResourceObject `json:"requests,omitempty"`
}

Resources describes the compute resource requirements.

type Secret

type Secret struct {
	Version string `json:"version,omitempty"`
	Kind    string `json:"kind,omitempty"`
	Type    string `json:"type,omitempty"`
	Name    string `json:"name,omitempty"`

	Data string    `json:"data,omitempty"`
	Get  SecretGet `json:"get,omitempty"`
}

Secret is a resource that provides encrypted data and pointers to external data (i.e. from vault).

func (*Secret) GetKind

func (s *Secret) GetKind() string

GetKind returns the resource kind.

func (*Secret) GetVersion

func (s *Secret) GetVersion() string

GetVersion returns the resource version.

func (*Secret) Validate

func (s *Secret) Validate() error

Validate returns an error if the secret is invalid.

type SecretGet

type SecretGet struct {
	Path string `json:"path,omitempty"`
	Name string `json:"name,omitempty"`
	Key  string `json:"key,omitempty"`
}

SecretGet defines a request to get a secret from an external sevice at the specified path, or with the specified name.

type Signature

type Signature struct {
	Version string `json:"version,omitempty"`
	Kind    string `json:"kind"`
	Hmac    string `json:"hmac"`
}

Signature is a resource that provides an hmac signature of combined resources. This signature can be used to validate authenticity and prevent tampering.

func (*Signature) GetKind

func (s *Signature) GetKind() string

GetKind returns the resource kind.

func (*Signature) GetVersion

func (s *Signature) GetVersion() string

GetVersion returns the resource version.

func (Signature) Validate

func (s Signature) Validate() error

Validate returns an error if the signature is invalid.

type Variable

type Variable struct {
	Value  string `json:"value,omitempty"`
	Secret string `json:"from_secret,omitempty" yaml:"from_secret"`
}

Variable represents an environment variable that can be defined as a string literal or as a reference to a secret.

func (*Variable) MarshalYAML added in v1.0.9

func (v *Variable) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml marshalling.

func (*Variable) UnmarshalYAML

func (v *Variable) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshalling.

type Volume

type Volume struct {
	Name     string          `json:"name,omitempty"`
	EmptyDir *VolumeEmptyDir `json:"temp,omitempty" yaml:"temp"`
	HostPath *VolumeHostPath `json:"host,omitempty" yaml:"host"`
}

Volume that can be mounted by containers.

type VolumeDevice

type VolumeDevice struct {
	Name       string `json:"name,omitempty"`
	DevicePath string `json:"path,omitempty" yaml:"path"`
}

VolumeDevice describes a mapping of a raw block device within a container.

type VolumeEmptyDir

type VolumeEmptyDir struct {
	Medium    string    `json:"medium,omitempty"`
	SizeLimit BytesSize `json:"size_limit,omitempty" yaml:"size_limit"`
}

VolumeEmptyDir mounts a temporary directory from the host node's filesystem into the container. This can be used as a shared scratch space.

type VolumeHostPath

type VolumeHostPath struct {
	Path string `json:"path,omitempty"`
}

VolumeHostPath mounts a file or directory from the host node's filesystem into your container.

type VolumeMount

type VolumeMount struct {
	Name      string `json:"name,omitempty"`
	MountPath string `json:"path,omitempty" yaml:"path"`
}

VolumeMount describes a mounting of a Volume within a container.

type Workspace

type Workspace struct {
	Base string `json:"base,omitempty"`
	Path string `json:"path,omitempty"`
}

Workspace represents the pipeline workspace configuraiton.

Jump to

Keyboard shortcuts

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