common

package
v0.0.0-...-04b9d05 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIRST InheritDependencyPolicy = "first" // default
	LAST                          = "last"  // useful when you want to overlay with a dep as last but inherit from it
	NONE                          = "none"
)
View Source
const EnvAciPath = "ACI_PATH"
View Source
const EnvAciTarget = "ACI_TARGET"
View Source
const EnvBuilderCommand = "BUILDER_COMMAND"
View Source
const EnvCatchOnError = "CATCH_ON_ERROR"
View Source
const EnvCatchOnStep = "CATCH_ON_STEP"
View Source
const EnvDgrVersion = "DGR_VERSION"
View Source
const EnvLogLevel = "LOG_LEVEL"
View Source
const ManifestDrgVersion = "dgr-version"
View Source
const PathAciManifest = "/aci-manifest.yml"
View Source
const PathBuilder = "/builder"
View Source
const PathImageAci = "/image.aci"
View Source
const PathManifest = "/manifest"
View Source
const PathManifestYmlTmpl = "/aci-manifest.yml.tmpl"
View Source
const PathRootfs = "/rootfs"
View Source
const PrefixBuilder = "builder/"

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(source string, dest string) (err error)

func CopyFile

func CopyFile(src, dst string) (err error)

func ExecCmd

func ExecCmd(head string, parts ...string) error

func ExecCmdGetOutput

func ExecCmdGetOutput(head string, parts ...string) (string, error)

func ExecCmdGetStderr

func ExecCmdGetStderr(head string, parts ...string) (string, error)

func ExecCmdGetStdoutAndStderr

func ExecCmdGetStdoutAndStderr(head string, parts ...string) (string, string, error)

func ExtractManifestContentFromAci

func ExtractManifestContentFromAci(aciPath string) ([]byte, error)

func ExtractManifestFromAci

func ExtractManifestFromAci(aciPath string) (*schema.ImageManifest, error)

func GenerateVersion

func GenerateVersion(aciHome string) string

func GitHash

func GitHash(path string) (string, error)

func IsDirEmpty

func IsDirEmpty(name string) (bool, error)

func ToAppcDependencies

func ToAppcDependencies(dependencies []ACFullname) (types.Dependencies, error)

func ToAppcIsolators

func ToAppcIsolators(isos []Isolator) (types.Isolators, error)

func WriteAciManifest

func WriteAciManifest(m *AciManifest, targetFile string, projectName string, dgrVersion string) error

Types

type ACFullname

type ACFullname string

func ExtractNameVersionFromManifest

func ExtractNameVersionFromManifest(im *schema.ImageManifest) *ACFullname

func FromAppcDependencies

func FromAppcDependencies(dependencies types.Dependencies) []ACFullname

func NewACFullName

func NewACFullName(s string) *ACFullname

example.com/dgr/yopla:1

func NewACFullnameFromNameAndVersion

func NewACFullnameFromNameAndVersion(name string, version string) *ACFullname

func NewACFullnameWithVersion

func NewACFullnameWithVersion(source ACFullname, version string) *ACFullname

func (ACFullname) DomainName

func (n ACFullname) DomainName() string

example.com

func (ACFullname) FullyResolved

func (n ACFullname) FullyResolved() (*ACFullname, error)

func (ACFullname) LatestVersion

func (n ACFullname) LatestVersion() (string, error)

func (ACFullname) MarshalJSON

func (n ACFullname) MarshalJSON() ([]byte, error)

func (ACFullname) Name

func (n ACFullname) Name() string

example.com/dgr/yopla

func (ACFullname) ShortName

func (n ACFullname) ShortName() string

dgr/yopla

func (ACFullname) String

func (n ACFullname) String() string

func (ACFullname) TinyName

func (n ACFullname) TinyName() string

yopla

func (ACFullname) TinyNameId

func (n ACFullname) TinyNameId() string

yopla:1

func (*ACFullname) UnmarshalJSON

func (n *ACFullname) UnmarshalJSON(data []byte) error

func (ACFullname) Version

func (n ACFullname) Version() string

1

type AciDefinition

type AciDefinition struct {
	App           DgrApp            `json:"app,omitempty" yaml:"app,omitempty"`
	Annotations   types.Annotations `json:"annotations,omitempty" yaml:"annotations,omitempty"`
	Dependencies  []ACFullname      `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	PathWhitelist []string          `json:"pathWhitelist,omitempty" yaml:"pathWhitelist,omitempty"`
}

type AciManifest

type AciManifest struct {
	NameAndVersion ACFullname        `json:"name,omitempty" yaml:"name,omitempty"`
	Builder        BuilderDefinition `json:"builder,omitempty" yaml:"builder,omitempty"`
	Build          BuildDefinition   `json:"build,omitempty" yaml:"build,omitempty"`
	Aci            AciDefinition     `json:"aci,omitempty" yaml:"aci,omitempty"`
	Tester         TestManifest      `json:"tester,omitempty" yaml:"tester,omitempty"`
}

func ProcessManifestTemplate

func ProcessManifestTemplate(manifestContent string, data2 interface{}, checkNoValue bool) (*AciManifest, error)

type BuildDefinition

type BuildDefinition struct {
	MountPoints []MountInfo `json:"mountPoints,omitempty" yaml:"mountPoints,omitempty"`
}

type BuilderCommand

type BuilderCommand string
const (
	CommandBuild BuilderCommand = "build"
	CommandInit  BuilderCommand = "init"
	CommandTry   BuilderCommand = "try"
)

func (BuilderCommand) CommandManifestKey

func (b BuilderCommand) CommandManifestKey() (string, error)

type BuilderDefinition

type BuilderDefinition struct {
	Image        ACFullname        `json:"image,omitempty" yaml:"image,omitempty"`
	Environment  types.Environment `json:"environment,omitempty" yaml:"environment,omitempty"`
	Dependencies []ACFullname      `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	MountPoints  []MountInfo       `json:"mountPoints,omitempty" yaml:"mountPoints,omitempty"`
}

type DgrApp

type DgrApp struct {
	Exec              types.Exec         `json:"exec,omitempty" yaml:"exec,omitempty"`
	User              string             `json:"user,omitempty" yaml:"user,omitempty"`
	Group             string             `json:"group,omitempty" yaml:"group,omitempty"`
	SupplementaryGIDs []int              `json:"supplementaryGIDs,omitempty" yaml:"supplementaryGIDs,omitempty"`
	WorkingDirectory  string             `json:"workingDirectory,omitempty" yaml:"workingDirectory,omitempty"`
	Environment       types.Environment  `json:"environment,omitempty" yaml:"environment,omitempty"`
	MountPoints       []types.MountPoint `json:"mountPoints,omitempty" yaml:"mountPoints,omitempty"`
	Ports             []types.Port       `json:"ports,omitempty" yaml:"ports,omitempty"`
	Isolators         []Isolator         `json:"isolators,omitempty" yaml:"isolators,omitempty"`
}

type Env

type Env struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type InheritDependencyPolicy

type InheritDependencyPolicy string

func (InheritDependencyPolicy) GetInheritDependency

func (i InheritDependencyPolicy) GetInheritDependency(r RuntimeApp) *ACFullname

type InsecuOptions

type InsecuOptions []string

func (InsecuOptions) HasImage

func (i InsecuOptions) HasImage() bool

func (InsecuOptions) ToDiscoveryInsecureOption

func (i InsecuOptions) ToDiscoveryInsecureOption() discovery.InsecureOption

type Isolator

type Isolator struct {
	Name  string
	Value interface{}
}

func FromAppcIsolators

func FromAppcIsolators(isolators types.Isolators) ([]Isolator, error)

type LinuxCapabilitiesSetValue

type LinuxCapabilitiesSetValue struct {
	Set []types.LinuxCapability `json:"set"`
}

type MountInfo

type MountInfo struct {
	From string `json:"from"`
	To   string `json:"to"`
}

type PodDefinition

type PodDefinition struct {
	Apps        []RuntimeApp        `json:"apps,omitempty" yaml:"apps,omitempty"`
	Volumes     []types.Volume      `json:"volumes,omitempty" yaml:"volumes,omitempty"`
	Isolators   []types.Isolator    `json:"isolators,omitempty" yaml:"isolators,omitempty"`
	Annotations types.Annotations   `json:"annotations,omitempty" yaml:"annotations,omitempty"`
	Ports       []types.ExposedPort `json:"ports,omitempty" yaml:"ports,omitempty"`
}

type PodManifest

type PodManifest struct {
	Name ACFullname     `json:"name,omitempty" yaml:"name,omitempty"`
	Pod  *PodDefinition `json:"pod,omitempty" yaml:"pod,omitempty"`
}

type PullPolicy

type PullPolicy string
const (
	PullPolicyNever  PullPolicy = "never"
	PullPolicyNew    PullPolicy = "new"
	PullPolicyUpdate PullPolicy = "update"
)

func (PullPolicy) IsValid

func (p PullPolicy) IsValid() bool

type RktClient

type RktClient struct {
	Version Version
	// contains filtered or unexported fields
}

func NewRktClient

func NewRktClient(config RktConfig) (*RktClient, error)

func (*RktClient) CatManifest

func (rkt *RktClient) CatManifest(image string) (string, error)

func (*RktClient) Fetch

func (rkt *RktClient) Fetch(image string, pullPolicy PullPolicy) (string, error)

func (*RktClient) FetchInsecure

func (rkt *RktClient) FetchInsecure(image string) (string, error)

func (*RktClient) GetManifest

func (rkt *RktClient) GetManifest(image string) (schema.ImageManifest, error)

func (*RktClient) GetPath

func (rkt *RktClient) GetPath() (string, error)

func (*RktClient) GetVersion

func (rkt *RktClient) GetVersion() (Version, error)

func (*RktClient) ImageRm

func (rkt *RktClient) ImageRm(images string) error

func (*RktClient) Rm

func (rkt *RktClient) Rm(uuids string) (string, string, error)

func (*RktClient) RmFromFile

func (rkt *RktClient) RmFromFile(path string) (string, string, error)

func (*RktClient) Run

func (rkt *RktClient) Run(args []string) error

type RktConfig

type RktConfig struct {
	Path            string        `yaml:"path"`
	InsecureOptions InsecuOptions `yaml:"insecureOptions"`

	LocalConfig        string     `yaml:"localConfig"`
	SystemConfig       string     `yaml:"systemConfig"`
	UserConfig         string     `yaml:"userConfig"`
	PullPolicy         PullPolicy `yaml:"pullPolicy"`
	TrustKeysFromHttps bool       `yaml:"trustKeysFromHttps"`
	NoStore            bool       `yaml:"noStore"`
	StoreOnly          bool       `yaml:"storeOnly"`
	// contains filtered or unexported fields
}

type RuntimeApp

type RuntimeApp struct {
	InheritDependencyPolicy InheritDependencyPolicy `json:"inheritDependencyPolicy,omitempty" yaml:"inheritDependencyPolicy,omitempty"`
	Dependencies            []ACFullname            `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Name                    string                  `json:"name,omitempty" yaml:"name,omitempty"`
	App                     DgrApp                  `json:"app,omitempty" yaml:"app,omitempty"`
	Mounts                  []schema.Mount          `json:"mounts,omitempty" yaml:"mounts,omitempty"`
	Annotations             types.Annotations       `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

type TestManifest

type TestManifest struct {
	Builder BuilderDefinition `json:"builder,omitempty" yaml:"builder,omitempty"`
	Aci     AciDefinition     `json:"aci,omitempty" yaml:"aci,omitempty"`
}

type Version

type Version string

Version provides utility methods for comparing versions.

func (Version) Equal

func (v Version) Equal(other Version) bool

Equal checks if a version is equal to another

func (Version) GreaterThan

func (v Version) GreaterThan(other Version) bool

GreaterThan checks if a version is greater than another

func (Version) GreaterThanOrEqualTo

func (v Version) GreaterThanOrEqualTo(other Version) bool

GreaterThanOrEqualTo checks if a version is greater than or equal to another

func (Version) LessThan

func (v Version) LessThan(other Version) bool

LessThan checks if a version is less than another

func (Version) LessThanOrEqualTo

func (v Version) LessThanOrEqualTo(other Version) bool

LessThanOrEqualTo checks if a version is less than or equal to another

Jump to

Keyboard shortcuts

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