distro

package
v0.0.0-...-418c65a Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DockerImageBuildTypeImport = "import"
	DockerImageBuildTypePull   = "pull"

	// Recognized architectures, should be in the form ${GOOS}_${GOARCH}.
	ArchDarwinAmd64  = "darwin_amd64"
	ArchLinux386     = "linux_386"
	ArchLinuxPpc64le = "linux_ppc64le"
	ArchLinuxS390x   = "linux_s390x"
	ArchLinuxArm64   = "linux_arm64"
	ArchLinuxAmd64   = "linux_amd64"
	ArchWindows386   = "windows_386"
	ArchWindowsAmd64 = "windows_amd64"

	// Bootstrapping mechanisms
	BootstrapMethodLegacySSH          = "legacy-ssh"
	BootstrapMethodSSH                = "ssh"
	BootstrapMethodPreconfiguredImage = "preconfigured-image"
	BootstrapMethodUserData           = "user-data"

	// Means of communicating with hosts
	CommunicationMethodLegacySSH = "legacy-ssh"
	CommunicationMethodSSH       = "ssh"
	CommunicationMethodRPC       = "rpc"

	CloneMethodLegacySSH = "legacy-ssh"
	CloneMethodOAuth     = "oauth"
)
View Source
const Collection = "distro"

Variables

View Source
var (
	// bson fields for the Distro struct
	IdKey                = bsonutil.MustHaveTag(Distro{}, "Id")
	AliasesKey           = bsonutil.MustHaveTag(Distro{}, "Aliases")
	ArchKey              = bsonutil.MustHaveTag(Distro{}, "Arch")
	PoolSizeKey          = bsonutil.MustHaveTag(Distro{}, "PoolSize")
	ProviderKey          = bsonutil.MustHaveTag(Distro{}, "Provider")
	ProviderSettingsKey  = bsonutil.MustHaveTag(Distro{}, "ProviderSettings")
	SetupAsSudoKey       = bsonutil.MustHaveTag(Distro{}, "SetupAsSudo")
	SetupKey             = bsonutil.MustHaveTag(Distro{}, "Setup")
	UserKey              = bsonutil.MustHaveTag(Distro{}, "User")
	SSHKeyKey            = bsonutil.MustHaveTag(Distro{}, "SSHKey")
	SSHOptionsKey        = bsonutil.MustHaveTag(Distro{}, "SSHOptions")
	BootstrapSettingsKey = bsonutil.MustHaveTag(Distro{}, "BootstrapSettings")
	CloneMethodKey       = bsonutil.MustHaveTag(Distro{}, "CloneMethod")
	WorkDirKey           = bsonutil.MustHaveTag(Distro{}, "WorkDir")
	SpawnAllowedKey      = bsonutil.MustHaveTag(Distro{}, "SpawnAllowed")
	ExpansionsKey        = bsonutil.MustHaveTag(Distro{}, "Expansions")
	DisabledKey          = bsonutil.MustHaveTag(Distro{}, "Disabled")
	ContainerPoolKey     = bsonutil.MustHaveTag(Distro{}, "ContainerPool")
	PlannerSettingsKey   = bsonutil.MustHaveTag(Distro{}, "PlannerSettings")
	FinderSettingsKey    = bsonutil.MustHaveTag(Distro{}, "FinderSettings")
)
View Source
var (
	// bson fields for the BootstrapSettings struct
	BootstrapSettingsMethodKey                = bsonutil.MustHaveTag(BootstrapSettings{}, "Method")
	BootstrapSettingsCommunicationKey         = bsonutil.MustHaveTag(BootstrapSettings{}, "Communication")
	BootstrapSettingsShellPathKey             = bsonutil.MustHaveTag(BootstrapSettings{}, "ShellPath")
	BootstrapSettingsJasperBinaryDirKey       = bsonutil.MustHaveTag(BootstrapSettings{}, "JasperBinaryDir")
	BootstrapSettingsClientDirKey             = bsonutil.MustHaveTag(BootstrapSettings{}, "ClientDir")
	BootstrapSettingsJasperCredentialsPathKey = bsonutil.MustHaveTag(BootstrapSettings{}, "JasperCredentialsPath")
)
View Source
var All = db.Query(nil).Sort([]string{IdKey})

All is a query that returns all distros.

Functions

func ByActiveOrStatic

func ByActiveOrStatic() db.Q

ByActiveOrStatic returns a query that selects only active or static distros

func ById

func ById(id string) db.Q

ById returns a query that contains an Id selector on the string, id.

func ByIds

func ByIds(ids []string) db.Q

ByIds creates a query that finds all distros for the given ids and implicitly returns them ordered by {"_id": 1}

func ByProvider

func ByProvider(p string) db.Q

ByProvider returns a query that contains a Provider selector on the string, p.

func BySpawnAllowed

func BySpawnAllowed() db.Q

BySpawnAllowed returns a query that contains the SpawnAllowed selector.

func Remove

func Remove(id string) error

Remove removes one distro.

func ValidateArch

func ValidateArch(arch string) error

ValidateArch checks that the architecture is one of the supported architectures.

func ValidateCloneMethod

func ValidateCloneMethod(method string) error

ValidateCloneMethod checks that the clone mechanism is one of the supported methods.

func ValidateContainerPoolDistros

func ValidateContainerPoolDistros(s *evergreen.Settings) error

ValidateContainerPoolDistros ensures that container pools have valid distros

Types

type AliasLookupTable

type AliasLookupTable map[string][]string

func NewDistroAliasesLookupTable

func NewDistroAliasesLookupTable() (AliasLookupTable, error)

func (AliasLookupTable) Expand

func (da AliasLookupTable) Expand(in []string) []string

type BootstrapSettings

type BootstrapSettings struct {
	Method                string `bson:"method" json:"method" mapstructure:"method"`
	Communication         string `bson:"communication,omitempty" json:"communication,omitempty" mapstructure:"communication,omitempty"`
	ClientDir             string `bson:"client_dir,omitempty" json:"client_dir,omitempty" mapstructure:"client_dir,omitempty"`
	JasperBinaryDir       string `bson:"jasper_binary_dir,omitempty" json:"jasper_binary_dir,omitempty" mapstructure:"jasper_binary_dir,omitempty"`
	JasperCredentialsPath string `` /* 130-byte string literal not displayed */
	ShellPath             string `bson:"shell_path,omitempty" json:"shell_path,omitempty" mapstructure:"shell_path,omitempty"`
}

BootstrapSettings encapsulates all settings related to bootstrapping hosts.

func (*BootstrapSettings) Validate

func (s *BootstrapSettings) Validate() error

Validate checks if all of the bootstrap settings are valid for legacy or non-legacy bootstrapping.

type Distro

type Distro struct {
	Id                string                  `bson:"_id" json:"_id,omitempty" mapstructure:"_id,omitempty"`
	Aliases           []string                `bson:"aliases,omitempty" json:"aliases,omitempty" mapstructure:"aliases,omitempty"`
	Arch              string                  `bson:"arch" json:"arch,omitempty" mapstructure:"arch,omitempty"`
	WorkDir           string                  `bson:"work_dir" json:"work_dir,omitempty" mapstructure:"work_dir,omitempty"`
	PoolSize          int                     `bson:"pool_size,omitempty" json:"pool_size,omitempty" mapstructure:"pool_size,omitempty" yaml:"poolsize"`
	Provider          string                  `bson:"provider" json:"provider,omitempty" mapstructure:"provider,omitempty"`
	ProviderSettings  *map[string]interface{} `bson:"settings" json:"settings,omitempty" mapstructure:"settings,omitempty"`
	SetupAsSudo       bool                    `bson:"setup_as_sudo,omitempty" json:"setup_as_sudo,omitempty" mapstructure:"setup_as_sudo,omitempty"`
	Setup             string                  `bson:"setup,omitempty" json:"setup,omitempty" mapstructure:"setup,omitempty"`
	Teardown          string                  `bson:"teardown,omitempty" json:"teardown,omitempty" mapstructure:"teardown,omitempty"`
	User              string                  `bson:"user,omitempty" json:"user,omitempty" mapstructure:"user,omitempty"`
	BootstrapSettings BootstrapSettings       `bson:"bootstrap_settings" json:"bootstrap_settings" mapstructure:"bootstrap_settings"`
	CloneMethod       string                  `bson:"clone_method" json:"clone_method,omitempty" mapstructure:"clone_method,omitempty"`
	SSHKey            string                  `bson:"ssh_key,omitempty" json:"ssh_key,omitempty" mapstructure:"ssh_key,omitempty"`
	SSHOptions        []string                `bson:"ssh_options,omitempty" json:"ssh_options,omitempty" mapstructure:"ssh_options,omitempty"`
	SpawnAllowed      bool                    `bson:"spawn_allowed" json:"spawn_allowed,omitempty" mapstructure:"spawn_allowed,omitempty"`
	Expansions        []Expansion             `bson:"expansions,omitempty" json:"expansions,omitempty" mapstructure:"expansions,omitempty"`
	Disabled          bool                    `bson:"disabled,omitempty" json:"disabled,omitempty" mapstructure:"disabled,omitempty"`
	ContainerPool     string                  `bson:"container_pool,omitempty" json:"container_pool,omitempty" mapstructure:"container_pool,omitempty"`
	PlannerSettings   PlannerSettings         `bson:"planner_settings" json:"planner_settings,omitempty" mapstructure:"planner_settings,omitempty"`
	FinderSettings    FinderSettings          `bson:"finder_settings" json:"finder_settings,omitempty" mapstructure:"finder_settings,omitempty"`
}

func Find

func Find(query db.Q) ([]Distro, error)

Find gets every Distro matching the given query.

func FindAll

func FindAll() ([]Distro, error)

func FindByID

func FindByID(id string) (*Distro, error)

func FindOne

func FindOne(query db.Q) (Distro, error)

FindOne gets one Distro for the given query.

func (*Distro) BinaryName

func (d *Distro) BinaryName() string

func (*Distro) ExecutableSubPath

func (d *Distro) ExecutableSubPath() string

ExecutableSubPath returns the directory containing the compiled agents.

func (*Distro) GenerateName

func (d *Distro) GenerateName() string

GenerateName generates a unique instance name for a distro.

func (*Distro) GetExpectedRuntimeFactor

func (d *Distro) GetExpectedRuntimeFactor() int64

func (*Distro) GetImageID

func (d *Distro) GetImageID() (string, error)

func (*Distro) GetPatchFactor

func (d *Distro) GetPatchFactor() int64

func (*Distro) GetPoolSize

func (d *Distro) GetPoolSize() int

func (*Distro) GetResolvedPlannerSettings

func (d *Distro) GetResolvedPlannerSettings(s *evergreen.Settings) (PlannerSettings, error)

GetResolvedPlannerSettings combines the distro's PlannerSettings fields with the SchedulerConfig defaults to resolve and validate a canonical set of PlannerSettings' field values.

func (*Distro) GetTimeInQueueFactor

func (d *Distro) GetTimeInQueueFactor() int64

func (*Distro) HomeDir

func (d *Distro) HomeDir() string

HomeDir gets the absolute path to the home directory for this distro's user.

func (*Distro) Insert

func (d *Distro) Insert() error

Insert writes the distro to the database.

func (*Distro) IsEphemeral

func (d *Distro) IsEphemeral() bool

func (*Distro) IsParent

func (d *Distro) IsParent(s *evergreen.Settings) bool

IsParent returns whether the distro is the parent distro for any container pool

func (*Distro) IsWindows

func (d *Distro) IsWindows() bool

func (*Distro) MaxDurationPerHost

func (d *Distro) MaxDurationPerHost() time.Duration

func (*Distro) Platform

func (d *Distro) Platform() (string, string)

func (*Distro) ShouldGroupVersions

func (d *Distro) ShouldGroupVersions() bool

func (*Distro) Update

func (d *Distro) Update() error

Update updates one distro.

type DistroGroup

type DistroGroup []Distro

func (DistroGroup) GetDistroIds

func (distros DistroGroup) GetDistroIds() []string

GetDistroIds returns a slice of distro IDs for the given group of distros

type Expansion

type Expansion struct {
	Key   string `bson:"key,omitempty" json:"key,omitempty"`
	Value string `bson:"value,omitempty" json:"value,omitempty"`
}

type FinderSettings

type FinderSettings struct {
	Version string `bson:"version" json:"version" mapstructure:"version"`
}

type PlannerSettings

type PlannerSettings struct {
	Version                string        `bson:"version" json:"version" mapstructure:"version"`
	MinimumHosts           int           `bson:"minimum_hosts" json:"minimum_hosts,omitempty" mapstructure:"minimum_hosts,omitempty"`
	MaximumHosts           int           `bson:"maximum_hosts" json:"maximum_hosts,omitempty" mapstructure:"maximum_hosts,omitempty"`
	TargetTime             time.Duration `bson:"target_time" json:"target_time" mapstructure:"target_time,omitempty"`
	AcceptableHostIdleTime time.Duration `bson:"acceptable_host_idle_time" json:"acceptable_host_idle_time" mapstructure:"acceptable_host_idle_time,omitempty"`
	GroupVersions          *bool         `bson:"group_versions" json:"group_versions" mapstructure:"group_versions,omitempty"`
	TaskOrdering           string        `bson:"task_ordering" json:"task_ordering" mapstructure:"task_ordering,omitempty"`
	PatchFactor            int64         `bson:"patch_zipper_factor" json:"patch_factor" mapstructure:"patch_factor"`
	TimeInQueueFactor      int64         `bson:"time_in_queue_factor" json:"time_in_queue_factor" mapstructure:"time_in_queue_factor"`
	ExpectedRuntimeFactor  int64         `bson:"expected_runtime_factor" json:"expected_runtime_factor" mapstructure:"expected_runtime_factor"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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