feat(*): add post up task type

This commit is contained in:
Michelle Noorali 2018-12-08 17:22:26 -05:00
Родитель 8e5c902837
Коммит bbc00d56f1
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -263,7 +263,10 @@ func (u *upCmd) run(environment string) (err error) {
if err := runPostDeployTasks(taskList, bldr.ID); err != nil {
debug(err.Error())
return nil
}
if _, err = taskList.Run(tasks.DefaultRunner, tasks.PostUp, ""); err != nil {
debug(err.Error())
}
return nil

Просмотреть файл

@ -19,6 +19,8 @@ var (
const (
// PreUp are the kind of tasks to be executed in preparation to an up command
PreUp = "PreUp"
// PostUp are the kind of tasks to be executed after an up command and post-deploy tasks have executed
PostUp = "PostUp"
// PostDeploy are the kind of tasks to be executed after a deploy command
PostDeploy = "PostDeploy"
// PostDelete are the kind of tasks to be executed after a delete command
@ -42,6 +44,7 @@ var DefaultRunner = func(c *exec.Cmd) error { return c.Run() }
// Tasks represents the different kinds of tasks read from Tasks' file
type Tasks struct {
PreUp map[string]string `toml:"pre-up"`
PostUp map[string]string `toml:"post-up"`
PostDeploy map[string]string `toml:"post-deploy"`
PostDelete map[string]string `toml:"cleanup"`
}
@ -81,6 +84,11 @@ func (t *Tasks) Run(runner Runner, kind, podName string) ([]Result, error) {
result := executeTask(runner, task, kind)
results = append(results, result)
}
case PostUp:
for _, task := range t.PostUp {
result := executeTask(runner, task, kind)
results = append(results, result)
}
case PostDeploy:
for _, task := range t.PostDeploy {
cmd := preparePostDeployTask(evaluateArgs(task), podName)