distro

package
v0.0.0-...-366f0b0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 13 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")
	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")
	BootstrapMethodKey       = bsonutil.MustHaveTag(Distro{}, "BootstrapMethod")
	CommunicationMethodKey   = bsonutil.MustHaveTag(Distro{}, "CommunicationMethod")
	CloneMethodKey           = bsonutil.MustHaveTag(Distro{}, "CloneMethod")
	ShellPathKey             = bsonutil.MustHaveTag(Distro{}, "ShellPath")
	CuratorDirKey            = bsonutil.MustHaveTag(Distro{}, "CuratorDir")
	ClientDirKey             = bsonutil.MustHaveTag(Distro{}, "ClientDir")
	JasperCredentialsPathKey = bsonutil.MustHaveTag(Distro{}, "JasperCredentialsPath")
	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 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 ValidateBootstrapAndCommunicationMethods

func ValidateBootstrapAndCommunicationMethods(bootstrap string, communication string) error

ValidateBootstrapAndCommunicationMethods checks that the bootstrap and communication mechanisms are recognized, and that the combination of the two is allowed.

func ValidateBootstrapMethod

func ValidateBootstrapMethod(method string) error

ValidateBootstrapMethod checks that the bootstrap mechanism is one of the supported methods.

func ValidateCloneMethod

func ValidateCloneMethod(method string) error

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

func ValidateCommunicationMethod

func ValidateCommunicationMethod(method string) error

ValidateCommunicationMethod checks that the communication 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 Distro

type Distro struct {
	Id                    string                  `bson:"_id" json:"_id,omitempty" mapstructure:"_id,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"`
	BootstrapMethod       string                  `bson:"bootstrap_method,omitempty" json:"bootstrap_method,omitempty" mapstructure:"bootstrap_method,omitempty"`
	CommunicationMethod   string                  `bson:"communication_method,omitempty" json:"communication_method,omitempty" mapstructure:"communication_method,omitempty"`
	CloneMethod           string                  `bson:"clone_method" json:"clone_method,omitempty" mapstructure:"clone_method,omitempty"`
	ShellPath             string                  `bson:"shell_path" json:"shell_path" mapstructure:"shell_path,omitempty"`
	CuratorDir            string                  `bson:"curator_dir" json:"curator_dir" mapstructure:"curator_dir,omitempty"`
	ClientDir             string                  `bson:"client_dir" json:"client_dir" mapstructure:"client_dir,omitempty"`
	JasperCredentialsPath string                  `json:"jasper_credentials_path" bson:"jasper_credentials_path" mapstructure:"jasper_credentials_path,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 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) GetImageID

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

func (*Distro) GetResolvedPlannerSettings

func (d *Distro) GetResolvedPlannerSettings(config evergreen.SchedulerConfig) (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) 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) Platform

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

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"`
	PatchZipperFactor      int           `bson:"patch_zipper_factor" json:"patch_zipper_factor" mapstructure:"patch_zipper_factor,omitempty"`
	TaskOrdering           string        `bson:"task_ordering" json:"task_ordering" mapstructure:"task_ordering,omitempty"`
}

Jump to

Keyboard shortcuts

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