This repository has been archived on 2025-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
Files
drone-runner-podman/engine/spec.go
2019-10-10 19:01:58 -07:00

116 lines
4.0 KiB
Go

// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Polyform License
// that can be found in the LICENSE file.
package engine
type (
// Spec provides the pipeline spec. This provides the
// required instructions for reproducible pipeline
// execution.
Spec struct {
Platform Platform `json:"platform,omitempty"`
Files []*File `json:"files,omitempty"`
Steps []*Step `json:"steps,omitempty"`
Volumes []*Volume `json:"volumes,omitempty"`
Network Network `json:"network"`
}
// Step defines a pipeline step.
Step struct {
ID string `json:"id,omitempty"`
Command []string `json:"args,omitempty"`
Detach bool `json:"detach,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
DNS []string `json:"dns,omitempty"`
DNSSearch []string `json:"dns_search,omitempty"`
Entrypoint []string `json:"entrypoint,omitempty"`
Envs map[string]string `json:"environment,omitempty"`
ExtraHosts []string `json:"extra_hosts,omitempty"`
Files []*File `json:"files,omitempty"`
IgnoreErr bool `json:"ignore_err,omitempty"`
IgnoreStdout bool `json:"ignore_stderr,omitempty"`
IgnoreStderr bool `json:"ignore_stdout,omitempty"`
Image string `json:"image,omitempty"`
Name string `json:"name,omitempty"`
Network string `json:"network,omitempty"`
Networks []string `json:"networks,omitempty"`
Privileged bool `json:"privileged,omitempty"`
Pull PullPolicy `json:"pull,omitempty"`
RunPolicy RunPolicy `json:"run_policy,omitempty"`
Secrets []*Secret `json:"secrets,omitempty"`
User string `json:"user,omitempty"`
Volumes []*VolumeMount `json:"volumes,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
}
// File defines a file that should be uploaded or
// mounted somewhere in the step container or virtual
// machine prior to command execution.
File struct {
Path string `json:"path,omitempty"`
Mode uint32 `json:"mode,omitempty"`
Data []byte `json:"data,omitempty"`
IsDir bool `json:"is_dir,omitempty"`
}
// 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"`
}
// Secret represents a secret variable.
Secret struct {
Name string `json:"name,omitempty"`
Env string `json:"env,omitempty"`
Data []byte `json:"data,omitempty"`
Mask bool `json:"mask,omitempty"`
}
// State represents the process state.
State struct {
ExitCode int // Container exit code
Exited bool // Container exited
OOMKilled bool // Container is oom killed
}
// Volume that can be mounted by containers.
Volume struct {
EmptyDir *VolumeEmptyDir `json:"temp,omitempty"`
HostPath *VolumeHostPath `json:"host,omitempty"`
}
// VolumeMount describes a mounting of a Volume
// within a container.
VolumeMount struct {
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
}
// 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 {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Medium string `json:"medium,omitempty"`
SizeLimit int64 `json:"size_limit,omitempty"`
}
// VolumeHostPath mounts a file or directory from the
// host node's filesystem into your container.
VolumeHostPath struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
}
// Network that is created and attached to containers
Network struct {
ID string `json:"id,omitempty"`
}
)