Documentation
¶
Index ¶
- Constants
- func ChdirOrCreate(dir string) error
- func ParseContextFlags(flags []string, format string) (map[string]map[string]any, error)
- func RenderTemplate(content string, contexts map[string]map[string]any) (string, error)
- func ShellEscape(cmd string) string
- type Agent
- func (a *Agent) AgentWithCallback(callback func(interface{}), format int) RunOption
- func (a *Agent) AgentWithConfigs(w WorkflowConfig, i InventoryConfig) RunOption
- func (a *Agent) AgentWithContexts(contexts map[string]map[string]any) RunOption
- func (a *Agent) AgentWithFiles(w string, i string) RunOption
- func (a *Agent) Install(args InstallArgs) error
- func (a *Agent) InstallDev(ic InventoryConfig) error
- func (a *Agent) InstallProd(ic InventoryConfig) error
- func (a *Agent) Run(opts ...RunOption) error
- func (a *Agent) Uninstall(args UninstallArgs) error
- type AuthenticateArgs
- type CopyFileArgs
- type ExecuteArgs
- type ExecuteCommandArgs
- type InstallArgs
- type Inventory
- type InventoryConfig
- type Job
- type JobState
- type RunArgs
- type RunOption
- type Server
- type Ssh
- func (s *Ssh) Authenticate(args AuthenticateArgs) (*ssh.Client, error)
- func (s *Ssh) CopyFile(args CopyFileArgs) error
- func (s *Ssh) CopyTo(client *ssh.Client, source string, destination string) error
- func (s *Ssh) CreateDirectory(sftpClient *sftp.Client, dirPath string) error
- func (s *Ssh) ExecuteCommand(args ExecuteCommandArgs) (string, string, error)
- type State
- type Step
- type StepOutputPlain
- type UninstallArgs
- type Workflow
- func (w *Workflow) Dump(content WorkflowConfig) (*string, error)
- func (w *Workflow) Execute(args ExecuteArgs) error
- func (w *Workflow) Load(file string) (*WorkflowConfig, error)
- func (w *Workflow) Run(opts ...WorkflowRunOptions) error
- func (w *Workflow) WorkflowWithCallback(callback func(any), sot int) WorkflowRunOptions
- func (w *Workflow) WorkflowWithConfig(config WorkflowConfig) WorkflowRunOptions
- func (w *Workflow) WorkflowWithContexts(contexts map[string]map[string]any) WorkflowRunOptions
- func (w *Workflow) WorkflowWithDirectory(directory string) WorkflowRunOptions
- func (w *Workflow) WorkflowWithFile(file string) WorkflowRunOptions
- type WorkflowConfig
- type WorkflowRunArgs
- type WorkflowRunOptions
- type WorkflowStepOutputStruct
Constants ¶
View Source
const ( ContextFormatJSON = "json" ContextFormatBase64 = "base64" )
View Source
const ( StepOutputTypePlain = iota + 1 StepOutputTypeStruct StepOutputTypeJson )
Variables ¶
This section is empty.
Functions ¶
func ChdirOrCreate ¶ added in v0.1.3
func ParseContextFlags ¶ added in v0.2.0
ParseContextFlags parses CLI --context flags in "name:value" format into a nested map. Each flag is split on the first ":" only, so JSON values containing colons are handled correctly.
The format parameter controls how the value portion is interpreted:
- "json" (default): value is raw JSON
- "base64": value is a base64-encoded JSON string
func RenderTemplate ¶ added in v0.2.0
RenderTemplate resolves all ${{ context.key }} expressions in content using the provided context maps. Rendering is in-memory only.
func ShellEscape ¶ added in v0.1.3
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func (*Agent) AgentWithCallback ¶ added in v0.0.14
func (*Agent) AgentWithConfigs ¶ added in v0.0.13
func (a *Agent) AgentWithConfigs(w WorkflowConfig, i InventoryConfig) RunOption
func (*Agent) AgentWithContexts ¶ added in v0.2.0
func (*Agent) AgentWithFiles ¶ added in v0.0.13
func (*Agent) Install ¶
func (a *Agent) Install(args InstallArgs) error
func (*Agent) InstallDev ¶
func (a *Agent) InstallDev(ic InventoryConfig) error
This is meant for testing locally or in CI
func (*Agent) InstallProd ¶
func (a *Agent) InstallProd(ic InventoryConfig) error
func (*Agent) Uninstall ¶
func (a *Agent) Uninstall(args UninstallArgs) error
type AuthenticateArgs ¶
type CopyFileArgs ¶ added in v0.1.3
type ExecuteArgs ¶ added in v0.0.5
type ExecuteCommandArgs ¶ added in v0.0.9
type InstallArgs ¶ added in v0.0.7
type InstallArgs struct {
If string
Ic InventoryConfig
// Installation mode; options are `dev` or `prod`
Mode string
}
type Inventory ¶
type Inventory struct{}
func NewInventory ¶
func NewInventory() *Inventory
type InventoryConfig ¶
type InventoryConfig struct {
Servers []Server `yaml:"servers"`
}
type RunArgs ¶ added in v0.0.4
type RunArgs struct {
Wf *string
If *string
Wc *WorkflowConfig
Ic *InventoryConfig
Contexts map[string]map[string]any
Callback func(interface{})
StepOutputType int
}
type Server ¶
type Server struct {
Name string `yaml:"name"`
// IP Address or Domain
Host string `yaml:"host"`
// SSH Port, defaults to 22
Port int `yaml:"port,omitempty"`
User string `yaml:"user"`
SudoPassword string `yaml:"sudo-pass"`
SshPassword string `yaml:"ssh-pass"`
// File path to the SSH private key
PrivateSshKey string `yaml:"private-ssh-key"`
}
func (*Server) UnmarshalYAML ¶ added in v0.0.12
Custom UnmarshalYAML to read the private SSH key file
type Ssh ¶
type Ssh struct{}
func (*Ssh) Authenticate ¶
func (s *Ssh) Authenticate(args AuthenticateArgs) (*ssh.Client, error)
func (*Ssh) CopyFile ¶ added in v0.1.3
func (s *Ssh) CopyFile(args CopyFileArgs) error
func (*Ssh) CopyTo ¶
Copy file from local server to remote server
@example
ssh := NewSsh()
sshClient, err := ssh.Authenticate(AuthenticateArgs{
Host: "10.211.55.12",
Port: 22,
User: "ubuntu",
Password: "1234567890",
})
fmt.Println(err)
ssh.CopyTo(sshClient, "./from/one/place.yaml", "/to/another.yaml")
func (*Ssh) CreateDirectory ¶
func (*Ssh) ExecuteCommand ¶
func (s *Ssh) ExecuteCommand(args ExecuteCommandArgs) (string, string, error)
type StepOutputPlain ¶ added in v0.0.13
type StepOutputPlain string
type UninstallArgs ¶ added in v0.0.8
type UninstallArgs struct {
If string
Ic InventoryConfig
}
type Workflow ¶
type Workflow struct{}
func NewWorkflow ¶
func NewWorkflow() *Workflow
func (*Workflow) Dump ¶ added in v0.0.4
func (w *Workflow) Dump(content WorkflowConfig) (*string, error)
func (*Workflow) Execute ¶
func (w *Workflow) Execute(args ExecuteArgs) error
func (*Workflow) Run ¶ added in v0.0.13
func (w *Workflow) Run(opts ...WorkflowRunOptions) error
func (*Workflow) WorkflowWithCallback ¶ added in v0.0.13
func (w *Workflow) WorkflowWithCallback(callback func(any), sot int) WorkflowRunOptions
func (*Workflow) WorkflowWithConfig ¶ added in v0.0.13
func (w *Workflow) WorkflowWithConfig(config WorkflowConfig) WorkflowRunOptions
func (*Workflow) WorkflowWithContexts ¶ added in v0.2.0
func (w *Workflow) WorkflowWithContexts(contexts map[string]map[string]any) WorkflowRunOptions
func (*Workflow) WorkflowWithDirectory ¶ added in v0.2.0
func (w *Workflow) WorkflowWithDirectory(directory string) WorkflowRunOptions
func (*Workflow) WorkflowWithFile ¶ added in v0.0.13
func (w *Workflow) WorkflowWithFile(file string) WorkflowRunOptions
type WorkflowConfig ¶
type WorkflowRunArgs ¶ added in v0.0.13
type WorkflowRunOptions ¶ added in v0.0.13
type WorkflowRunOptions func(*WorkflowRunArgs)
type WorkflowStepOutputStruct ¶ added in v0.0.14
Source Files
¶
Click to show internal directories.
Click to hide internal directories.