Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Server *ConfigServer `yaml:"server"` Tasks []*Task `yaml:"tasks"` }
func LoadConfig ¶
type ConfigServer ¶
type ConfigServer struct { User string `yaml:"user"` Host string `yaml:"host"` SSHPrivateKeyPath string `yaml:"ssh_private_key_path"` }
func (*ConfigServer) ServerHost ¶
func (r *ConfigServer) ServerHost() string
type ConfigTaskCmd ¶
type ConfigTaskCmd struct {
Commands []string
}
func (ConfigTaskCmd) MarshalYAML ¶
func (r ConfigTaskCmd) MarshalYAML() (interface{}, error)
func (*ConfigTaskCmd) UnmarshalYAML ¶
func (r *ConfigTaskCmd) UnmarshalYAML(unmarshal func(interface{}) error) error
type ConfigTaskDownload ¶
type ConfigTaskUpload ¶
type IfExpr ¶
type IfExpr string
IfExpr 是 if 表达式,输入: string,输出: bool
IfExpr 支持下面几个函数和操作符
函数:exist 操作符:&& || !
示例 if: exist("/path") if: exist(/path) if: !exist(/path) if: exist(/path1) && !exist(/path2) if: (exist(/path1) || !exist(/path2)) && exist(/path3)
type Task ¶
type Task struct { // 公用 task 参数 ID string `yaml:"id"` // 唯一性 ID,不允许重复,可以通过 $tasks.<id>.outputs.<name> 取数据 Name string `yaml:"name"` // 名称,打印用 If IfExpr `yaml:"if"` // 一个 expr 表达式,为真,则这个 task 才可以运行 Dir string `yaml:"dir"` // 执行 command 的目录 // 下面是 task 的具体实现 Upload *ConfigTaskUpload `yaml:"upload"` Download *ConfigTaskDownload `yaml:"download"` Cmd *ConfigTaskCmd `yaml:"cmd"` LocalCmd *ConfigTaskCmd `yaml:"local_cmd"` }
Click to show internal directories.
Click to hide internal directories.