Add ability to mix database dump tasks with other tasks
continuous-integration/drone/push Build is passing Details

This commit is contained in:
IamTheFij 2022-11-03 16:10:33 -07:00
parent c0e1795a80
commit 5813fe56bf
1 changed files with 18 additions and 0 deletions

View File

@ -280,6 +280,8 @@ type JobTask struct {
Name string `hcl:"name,label"`
PreScripts []JobTaskScript `hcl:"pre_script,block"`
PostScripts []JobTaskScript `hcl:"post_script,block"`
MySQL []JobTaskMySQL `hcl:"mysql,block"`
Sqlite []JobTaskSqlite `hcl:"sqlite,block"`
}
func (t JobTask) Validate() error {
@ -293,6 +295,14 @@ func (t JobTask) Validate() error {
func (t JobTask) GetPreTasks() []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 {
exTask.SetName(t.Name)
allTasks = append(allTasks, exTask)
@ -309,5 +319,13 @@ func (t JobTask) GetPostTasks() []ExecutableTask {
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
}