2021-09-19 12:00:00 +00:00
|
|
|
// Copyright (c), the Drone Authors.
|
|
|
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
2019-02-10 19:00:16 +00:00
|
|
|
|
2019-01-22 23:44:17 +00:00
|
|
|
package yaml
|
|
|
|
|
|
|
|
// Pipeline is a resource that defines a continuous
|
|
|
|
// delivery pipeline.
|
|
|
|
type Pipeline struct {
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
Kind string `json:"kind,omitempty"`
|
|
|
|
Type string `json:"type,omitempty"`
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
|
2023-02-08 09:14:20 +00:00
|
|
|
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"`
|
|
|
|
ImagePullSecrets []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"`
|
2019-01-22 23:44:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetVersion returns the resource version.
|
|
|
|
func (p *Pipeline) GetVersion() string { return p.Version }
|
|
|
|
|
|
|
|
// GetKind returns the resource kind.
|
|
|
|
func (p *Pipeline) GetKind() string { return p.Kind }
|
|
|
|
|
|
|
|
type (
|
|
|
|
// Clone configures the git clone.
|
|
|
|
Clone struct {
|
|
|
|
Disable bool `json:"disable,omitempty"`
|
|
|
|
Depth int `json:"depth,omitempty"`
|
|
|
|
SkipVerify bool `json:"skip_verify,omitempty" yaml:"skip_verify"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Concurrency limits pipeline concurrency.
|
|
|
|
Concurrency struct {
|
|
|
|
Limit int `json:"limit,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Container defines a Docker container configuration.
|
|
|
|
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"`
|
2023-02-08 09:14:20 +00:00
|
|
|
NetworkMode string `json:"network_mode,omitempty" yaml:"network_mode"`
|
2019-01-22 23:44:17 +00:00
|
|
|
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"`
|
2019-04-11 02:31:22 +00:00
|
|
|
User string `json:"user,omitempty"`
|
2019-01-22 23:44:17 +00:00
|
|
|
Volumes []*VolumeMount `json:"volumes,omitempty"`
|
|
|
|
When Conditions `json:"when,omitempty"`
|
|
|
|
WorkingDir string `json:"working_dir,omitempty" yaml:"working_dir"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Resources describes the compute resource
|
|
|
|
// requirements.
|
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ResourceObject describes compute resource
|
|
|
|
// requirements.
|
|
|
|
ResourceObject struct {
|
2019-03-18 16:24:31 +00:00
|
|
|
CPU float64 `json:"cpu" yaml:"cpu"`
|
2019-01-22 23:44:17 +00:00
|
|
|
Memory BytesSize `json:"memory"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Platform defines the target platform.
|
|
|
|
Platform struct {
|
|
|
|
OS string `json:"os,omitempty"`
|
|
|
|
Arch string `json:"arch,omitempty"`
|
|
|
|
Variant string `json:"variant,omitempty"`
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Volume that can be mounted by containers.
|
|
|
|
Volume struct {
|
2023-02-08 09:14:20 +00:00
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Temp *VolumeEmptyDir `json:"temp,omitempty" yaml:"temp"`
|
|
|
|
Host *VolumeHostPath `json:"host,omitempty" yaml:"host"`
|
2019-01-22 23:44:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// VolumeDevice describes a mapping of a raw block
|
|
|
|
// device within a container.
|
|
|
|
VolumeDevice struct {
|
2023-02-08 09:14:20 +00:00
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Path string `json:"path,omitempty" yaml:"path"`
|
2019-01-22 23:44:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// VolumeMount describes a mounting of a Volume
|
|
|
|
// within a container.
|
|
|
|
VolumeMount struct {
|
2023-02-08 09:14:20 +00:00
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Path string `json:"path,omitempty" yaml:"path"`
|
2019-01-22 23:44:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// VolumeEmptyDir mounts a temporary directory from the
|
|
|
|
// host node's filesystem into the container. This can
|
|
|
|
// be used as a shared scratch space.
|
|
|
|
VolumeEmptyDir struct {
|
|
|
|
Medium string `json:"medium,omitempty"`
|
|
|
|
SizeLimit BytesSize `json:"size_limit,omitempty" yaml:"size_limit"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// VolumeHostPath mounts a file or directory from the
|
|
|
|
// host node's filesystem into your container.
|
|
|
|
VolumeHostPath struct {
|
|
|
|
Path string `json:"path,omitempty"`
|
|
|
|
}
|
|
|
|
|
2022-04-25 10:56:05 +00:00
|
|
|
// Workspace represents the pipeline workspace configuration.
|
2019-01-22 23:44:17 +00:00
|
|
|
Workspace struct {
|
|
|
|
Base string `json:"base,omitempty"`
|
|
|
|
Path string `json:"path,omitempty"`
|
|
|
|
}
|
|
|
|
)
|