Documentation ¶
Index ¶
Constants ¶
View Source
const ID = "deploy"
Variables ¶
View Source
var DeploySources = map[string]func(logId, buildDir string, d *DeployMeta) error{ "git": func(logId, buildDir string, d *DeployMeta) error { logger.LogMap.Add(logId, "Cloning "+d.Src.Url, true) _, err := git.PlainClone(buildDir, false, &git.CloneOptions{ URL: d.Src.Url, Auth: &githttp.BasicAuth{ Username: d.Src.Token, Password: d.Src.Token, }, Progress: logger.AutoLogger{ID: logId}, ReferenceName: plumbing.ReferenceName(d.Src.Ref), }) if err != nil { return err } return nil }, }
A deploy source is a public API provided for use by other sysmanage plugins
It accepts a string action to clone the source to the folder desired. ¶
E.g: func(logId, buildDir string, d *DeployMeta) error
View Source
var DeployWebhookSources = map[string]func(cfg *DeployMeta, wid, id, token string) (logId string, err error){ "api": func(cfg *DeployMeta, wid, id, token string) (logId string, err error) { var flag bool for _, webh := range cfg.Webhooks { if webh.Type != "api" { continue } if wid == webh.Id && webh.Token == token { flag = true break } } if !flag { return "", errors.New("invalid token") } reqId := crypto.RandString(64) go InitDeploy(reqId, cfg) return reqId, nil }, }
Public API to allow plugins to define custom webhook sources
Functions ¶
func InitDeploy ¶
func InitDeploy(logId string, d *DeployMeta)
func InitPlugin ¶
func InitPlugin(c *types.PluginConfig) error
Types ¶
type DeployMeta ¶
type DeployMeta struct { AllowedIps []string `yaml:"allowed_ips"` Src *DeploySource `yaml:"src"` Broken bool `yaml:"broken"` OutputPath string `yaml:"output_path"` Commands []string `yaml:"commands"` Webhooks []*DeployWebhook `yaml:"webhooks"` Timeout int `yaml:"timeout"` Env map[string]string `yaml:"env"` ConfigFiles []string `yaml:"config_files"` }
func LoadConfig ¶
func LoadConfig(name string) (*DeployMeta, error)
type DeployMetaListItem ¶
type DeployMetaListItem struct { ID string Meta *DeployMeta }
func GetDeployList ¶
func GetDeployList() ([]*DeployMetaListItem, error)
type DeploySource ¶
type DeploySource struct { Type string `yaml:"type"` Url string `yaml:"url"` Token string `yaml:"token"` Ref string `yaml:"ref"` }
func (DeploySource) String ¶
func (d DeploySource) String() string
type DeployStatus ¶
type DeployStatus struct { Source *DeploySource CreatedAt time.Time }
func (DeployStatus) String ¶
func (d DeployStatus) String() string
type DeployWebhook ¶
Click to show internal directories.
Click to hide internal directories.