yaml

package
v0.0.0-...-6bd371c Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

package yaml provides definitions for the Yaml schema.

Index

Constants

View Source
const (
	KindDeployment = "deployment"
	KindPipeline   = "pipeline"
	KindSecret     = "secret"
	KindSignature  = "signature"
)

Resource enums.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
	Retries    int  `json:"retries,omitempty"`
	SkipVerify bool `json:"skip_verify,omitempty" yaml:"skip_verify"`
	Trace      bool `json:"trace,omitempty"`
}

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"`
}

Conditions defines a group of conditions.

func (Conditions) Match

func (c Conditions) Match(m Match) bool

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

type DNSConfigOptions

type DNSConfigOptions struct {
	Name  string  `json:"name,omitempty"`
	Value *string `json:"value,omitempty" yaml:"value"`
}

DNSConfigOptions dns config option

type DnsConfig

type DnsConfig struct {
	Nameservers []string           `json:"nameservers,omitempty"`
	Searches    []string           `json:"searches,omitempty"`
	Options     []DNSConfigOptions `json:"options,omitempty"`
}

DnsConfig defines Kubernetes pod dnsConfig

type HostAlias

type HostAlias struct {
	IP        string   `json:"ip,omitempty"`
	Hostnames []string `json:"hostnames,omitempty"`
}

HostAlias hosts

type Match

type Match struct {
	Action   string
	Branch   string
	Cron     string
	Event    string
	Instance string
	Ref      string
	Repo     string
	Target   string
	Paths    []string
}

Match provides match creteria for evaluation.

type Metadata

type Metadata struct {
	Namespace   string            `json:"namespace,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
}

Metadata defines Kubernetes pod metadata

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

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"`
	Hmac        string            `json:"hmac,omitempty"`
	Deps        []string          `json:"deps,omitempty" yaml:"depends_on"`
	Node        map[string]string `json:"node,omitempty"`
	Concurrency Concurrency       `json:"concurrency,omitempty"`
	Platform    Platform          `json:"platform,omitempty"`
	Data        Secret            `json:"secret,omitempty"`
	Clone       Clone             `json:"clone,omitempty"`
	Trigger     Conditions        `json:"conditions,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`
	Services    []*Step           `json:"services,omitempty"`
	Steps       []*Step           `json:"steps,omitempty"`
	Volumes     []*Volume         `json:"volumes,omitempty"`
	PullSecrets []string          `json:"image_pull_secrets,omitempty" yaml:"image_pull_secrets"`
	Workspace   Workspace         `json:"workspace,omitempty"`

	// Kubernetes Runner
	DnsConfig      DnsConfig         `json:"dns_config,omitempty"   yaml:"dns_config"`
	HostAliases    []HostAlias       `json:"host_aliases,omitempty" yaml:"host_aliases"`
	Metadata       Metadata          `json:"metadata,omitempty"`
	NodeName       string            `json:"node_name,omitempty"            yaml:"node_name"`
	NodeSelector   map[string]string `json:"node_selector,omitempty"        yaml:"node_selector"`
	ServiceAccount string            `json:"service_account_name,omitempty" yaml:"service_account_name"`
	Tolerations    []Toleration      `json:"tolerations,omitempty"`
	Resource       Resources         `json:"resource,omitempty"`
}

Pipeline defines a pipeline resource.

func Parse

func Parse(r io.Reader) ([]*Pipeline, error)

Parse parses the configuration from io.Reader r.

func ParseBytes

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

ParseBytes parses the configuration from bytes b.

func ParseFile

func ParseFile(p string) ([]*Pipeline, error)

ParseFile parses the configuration from path p.

func ParseString

func ParseString(s string) ([]*Pipeline, error)

ParseString parses the configuration from string s.

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 ResourceLimits

type ResourceLimits struct {
	CPU    int64     `json:"cpu" yaml:"cpu"`
	Memory BytesSize `json:"memory"`
}

ResourceLimits configures resource limits.

type Resources

type Resources struct {
	Limits   ResourceLimits `json:"limits,omitempty" yaml:"limits"`
	Requests ResourceLimits `json:"requests,omitempty" yaml:"requests"`
}

Resources configures resource limits.

type Secret

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

Secret defines an external secret.

type Step

type Step struct {
	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"`
	MemLimit     BytesSize             `json:"mem_limit,omitempty" yaml:"mem_limit"`
	MemSwapLimit BytesSize             `json:"memswap_limit,omitempty" yaml:"memswap_limit"`
	Network      string                `json:"network_mode,omitempty" yaml:"network_mode"`
	Name         string                `json:"name,omitempty"`
	Privileged   bool                  `json:"privileged,omitempty"`
	Pull         string                `json:"pull,omitempty"`
	Resource     Resources             `json:"resource,omitempty"`
	Settings     map[string]*Parameter `json:"settings,omitempty"`
	Shell        string                `json:"shell,omitempty"`
	ShmSize      BytesSize             `json:"shm_size,omitempty" yaml:"shm_size"`
	User         string                `json:"user,omitempty"`
	Volumes      []*VolumeMount        `json:"volumes,omitempty"`
	When         Conditions            `json:"when,omitempty"`
	WorkingDir   string                `json:"working_dir,omitempty" yaml:"working_dir"`
}

Step defines a Pipeline step.

type Toleration

type Toleration struct {
	Effect            string `json:"effect,omitempty"`
	Key               string `json:"key,omitempty"`
	Operator          string `json:"operator,omitempty"`
	TolerationSeconds *int   `json:"toleration_seconds,omitempty"`
	Value             string `json:"value,omitempty"`
}

Toleration defines Kubernetes pod tolerations

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

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

Jump to

Keyboard shortcuts

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