supfile

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AffixMappig

type AffixMappig struct {
	TargetName     string
	AffixedNetwork string
	CommandName    string
}

type Command

type Command struct {
	Name     string           `yaml:"-"`                     // Command name.
	Desc     string           `yaml:"desc"`                  // Command description.
	Local    string           `yaml:"local"`                 // Command(s) to be run locally.
	Run      string           `yaml:"run"`                   // Command(s) to be run remotelly.
	Script   string           `yaml:"script"`                // Load command(s) from script and run it remotelly.
	Upload   []*UploadOrder   `yaml:"upload","up"`           // See Upload struct.
	Stdin    bool             `yaml:"stdin"`                 // Attach localhost STDOUT to remote commands' STDIN?
	Once     bool             `yaml:"once"`                  // The command should be run "once" (on one host only).
	Serial   int              `yaml:"serial"`                // Max number of clients processing a task in parallel.
	Fetch    []*DownloadOrder `yaml:"fetch","download","dl"` // See Fetch struct.
	Sudo     bool             `yaml:"sudo" `                 // Run command(s) as root?
	SudoPass string           `yaml:"sudo_pass"`
	Env      EnvList          `yaml:"env"`
	Dist     string           `yaml:"dist"`

	// API backward compatibility. Will be deprecated in v1.0.
	RunOnce bool `yaml:"run_once"` // The command should be run once only.
}

Command represents command(s) to be run remotely.

func (*Command) String

func (c *Command) String() string

type Commands

type Commands struct {
	Names []string
	Cmds  map[string]Command
}

Commands is a list of user-defined commands

func (*Commands) Get

func (c *Commands) Get(name string) (Command, bool)

func (*Commands) Has

func (c *Commands) Has(name string) bool

func (*Commands) String

func (c *Commands) String() string

func (*Commands) UnmarshalYAML

func (c *Commands) UnmarshalYAML(unmarshal func(interface{}) error) error

type DownloadOrder

type DownloadOrder struct {
	Host string `yaml:"host"`
	Src  string `yaml:"src"`
	Dst  string `yaml:"dst"`
	Flat bool
}

type EnvList

type EnvList struct {
	// contains filtered or unexported fields
}

EnvList is a list of environment variables that maps to a YAML map, but maintains order, enabling late variables to reference early variables.

func (*EnvList) AsExport

func (e *EnvList) AsExport() string

func (EnvList) Get

func (e EnvList) Get(key string) string

func (EnvList) GetStore

func (e EnvList) GetStore() map[string]string

GetStore returns the whole store used in envsubst usecase

func (EnvList) Keys

func (e EnvList) Keys() []string

func (*EnvList) RemoveEnvVarByKey

func (e *EnvList) RemoveEnvVarByKey(key string) bool

RemoveEnvVarByKey removes an EnvVar from EnvList by key. It returns true if the variable was found and removed, or false otherwise.

func (*EnvList) Set

func (e *EnvList) Set(key, value string)

Set key to be equal value in this list.

func (EnvList) Slice

func (e EnvList) Slice() []string

func (*EnvList) String

func (e *EnvList) String() string

func (*EnvList) UnmarshalYAML

func (e *EnvList) UnmarshalYAML(unmarshal func(interface{}) error) error

type EnvVar

type EnvVar struct {
	Key   string
	Value string
}

EnvVar represents an environment variable

func (EnvVar) AsExport

func (e EnvVar) AsExport() string

AsExport returns the environment variable as a bash export statement

func (EnvVar) String

func (e EnvVar) String() string

type ErrMustUpdate

type ErrMustUpdate struct {
	Msg string
}

func (ErrMustUpdate) Error

func (e ErrMustUpdate) Error() string

type ErrUnsupportedSupfileVersion

type ErrUnsupportedSupfileVersion struct {
	Msg string
}

func (ErrUnsupportedSupfileVersion) Error

type Network

type Network struct {
	Env       EnvList       `yaml:"env"`
	Inventory string        `yaml:"inventory"`
	Hosts     []NetworkHost `yaml:"hosts"`
	Bastion   string        `yaml:"bastion"` // Jump host for the environment

	// Should these live on Hosts too? We'd have to change []string to struct, even in Supfile.
	User         string `yaml:"user"`
	Password     string `yaml:"pass" `
	IdentityFile string `yaml:"id_file"`
	Name         string
}

Network is group of hosts with extra custom env vars.

func (Network) ParseInventory

func (n Network) ParseInventory() ([]NetworkHost, error)

ParseInventory runs the inventory command, if provided, and appends the command's output lines to the manually defined list of hosts.

func (Network) String

func (n Network) String() string

func (*Network) UnmarshalYAML

func (n *Network) UnmarshalYAML(unmarshal func(interface{}) error) error

type NetworkHost

type NetworkHost struct {
	Host     string  `yaml:"host"`
	User     string  `yaml:"user"`
	Password string  `yaml:"pass"`
	Tube     string  `yaml:"tube"`
	Env      EnvList `yaml:"env"`
	Sudo     bool    `yaml:"sudo" default:"false"`
}

func (*NetworkHost) String

func (n *NetworkHost) String() string

func (*NetworkHost) UnmarshalYAML

func (n *NetworkHost) UnmarshalYAML(unmarshal func(interface{}) error) error

type Networks

type Networks struct {
	Names []string
	Nets  map[string]Network
}

Networks is a list of user-defined networks

func (*Networks) Get

func (n *Networks) Get(name string) (Network, bool)

func (*Networks) Set

func (n *Networks) Set(name string, value string)

this is just to set localhost so we dont process slice of values as we should be...

func (*Networks) String

func (n *Networks) String() string

func (*Networks) UnmarshalYAML

func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error

type Supfile

type Supfile struct {
	Networks Networks `yaml:"networks"`
	Commands Commands `yaml:"commands"`
	Targets  Targets  `yaml:"targets"`
	Env      EnvList  `yaml:"env"`
	Version  string   `yaml:"version"`
	Desc     string   `yaml:"desc"`
}

Supfile represents the Stack Up configuration YAML file.

func (Supfile) GetNetworkByName

func (s Supfile) GetNetworkByName(name string) (*Network, error)

func (Supfile) String

func (s Supfile) String() string

type Targets

type Targets struct {
	Names []string
	// contains filtered or unexported fields
}

Targets is a list of user-defined targets by default affixed are mapped by command name

func (*Targets) Get

func (t *Targets) Get(name string) ([]string, bool)

func (*Targets) GetAffixByCommandName

func (t *Targets) GetAffixByCommandName(name string) (AffixMappig, bool)

func (*Targets) Has

func (t *Targets) Has(name string) bool

func (*Targets) HasAffixes

func (t *Targets) HasAffixes() bool

func (*Targets) UnmarshalYAML

func (t *Targets) UnmarshalYAML(unmarshal func(interface{}) error) error

type UploadOrder

type UploadOrder struct {
	Src string `yaml:"src"`
	Dst string `yaml:"dst"`
	Exc string `yaml:"exclude"`
}

UploadOrder represents file copy operation from localhost Src path to Dst path of every host in a given Network.

func (*UploadOrder) UnmarshalYAML

func (u *UploadOrder) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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