ProcessTasks iterates over the list of tasks and attempts to run them all. If everything goes well, a nil error will be returned. On the first failure, the error will be returned and the process will halt. TODO some kind of progress/results callback? A Goroutine with channels?
(octopus *client.Client, space *spaces.Space, tasks []*Task)
| 39 | // On the first failure, the error will be returned and the process will halt. |
| 40 | // TODO some kind of progress/results callback? A Goroutine with channels? |
| 41 | func ProcessTasks(octopus *client.Client, space *spaces.Space, tasks []*Task) error { |
| 42 | for _, task := range tasks { |
| 43 | switch task.Type { |
| 44 | case TaskTypeCreateAccount: |
| 45 | if err := accountCreate(octopus, space, task.Options); err != nil { |
| 46 | return err |
| 47 | } |
| 48 | case TaskTypeCreateRelease: |
| 49 | if err := releaseCreate(octopus, space, task.Options); err != nil { |
| 50 | return err |
| 51 | } |
| 52 | case TaskTypeDeployRelease: |
| 53 | if err := releaseDeploy(octopus, space, task.Options); err != nil { |
| 54 | return err |
| 55 | } |
| 56 | case TaskTypeRunbookRun: |
| 57 | if err := runbookRun(octopus, space, task.Options); err != nil { |
| 58 | return err |
| 59 | } |
| 60 | case TaskTypeGitRunbookRun: |
| 61 | if err := gitRunbookRun(octopus, space, task.Options); err != nil { |
| 62 | return err |
| 63 | } |
| 64 | default: |
| 65 | return fmt.Errorf("unhandled task CommandType %s", task.Type) |
| 66 | } |
| 67 | } |
| 68 | return nil |
| 69 | } |
no test coverage detected