-
Notifications
You must be signed in to change notification settings - Fork 0
/
awsecs.go
36 lines (28 loc) · 816 Bytes
/
awsecs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package task
import (
"fmt"
"github.com/Excoriate/dagger-python-ecs/internal/common"
)
func RunTaskAWSECS(opt InitOptions) error {
taskSelector := common.NormaliseStringUpper(opt.Task)
taskPrefix := "AWS:ECS"
p := opt.PipelineCfg
j := opt.JobCfg
actionCMDs := opt.ActionCommands
switch taskSelector {
case "DEPLOY":
actionPrefix := fmt.Sprintf("%s:%s", taskPrefix, taskSelector)
// New (core) instance of a task
c := NewTask(p, j, actionCMDs, &opt)
// New specific instance of a task (E.g.: Docker, AWS, etc.)
t := NewTaskECS(c, actionCMDs, &opt, actionPrefix)
// New action to execute (mapped to the --task passed from the command line)
a := NewAWSECSDeployAction(t, actionPrefix)
// Run the action
_, err := a.DeployNewTask()
if err != nil {
return err
}
}
return nil
}