Add ability to mix database dump tasks with other tasks
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c0e1795a80
commit
5813fe56bf
18
tasks.go
18
tasks.go
@ -280,6 +280,8 @@ type JobTask struct {
|
|||||||
Name string `hcl:"name,label"`
|
Name string `hcl:"name,label"`
|
||||||
PreScripts []JobTaskScript `hcl:"pre_script,block"`
|
PreScripts []JobTaskScript `hcl:"pre_script,block"`
|
||||||
PostScripts []JobTaskScript `hcl:"post_script,block"`
|
PostScripts []JobTaskScript `hcl:"post_script,block"`
|
||||||
|
MySQL []JobTaskMySQL `hcl:"mysql,block"`
|
||||||
|
Sqlite []JobTaskSqlite `hcl:"sqlite,block"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t JobTask) Validate() error {
|
func (t JobTask) Validate() error {
|
||||||
@ -293,6 +295,14 @@ func (t JobTask) Validate() error {
|
|||||||
func (t JobTask) GetPreTasks() []ExecutableTask {
|
func (t JobTask) GetPreTasks() []ExecutableTask {
|
||||||
allTasks := []ExecutableTask{}
|
allTasks := []ExecutableTask{}
|
||||||
|
|
||||||
|
for _, task := range t.MySQL {
|
||||||
|
allTasks = append(allTasks, task.GetPreTask())
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, task := range t.Sqlite {
|
||||||
|
allTasks = append(allTasks, task.GetPreTask())
|
||||||
|
}
|
||||||
|
|
||||||
for _, exTask := range t.PreScripts {
|
for _, exTask := range t.PreScripts {
|
||||||
exTask.SetName(t.Name)
|
exTask.SetName(t.Name)
|
||||||
allTasks = append(allTasks, exTask)
|
allTasks = append(allTasks, exTask)
|
||||||
@ -309,5 +319,13 @@ func (t JobTask) GetPostTasks() []ExecutableTask {
|
|||||||
allTasks = append(allTasks, exTask)
|
allTasks = append(allTasks, exTask)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, task := range t.MySQL {
|
||||||
|
allTasks = append(allTasks, task.GetPostTask())
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, task := range t.Sqlite {
|
||||||
|
allTasks = append(allTasks, task.GetPostTask())
|
||||||
|
}
|
||||||
|
|
||||||
return allTasks
|
return allTasks
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user