-
Notifications
You must be signed in to change notification settings - Fork 0
/
awsecr.go
36 lines (28 loc) · 793 Bytes
/
awsecr.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/stiletto/internal/common"
)
func RunTaskAWSECR(opt InitOptions) error {
taskSelector := common.NormaliseStringUpper(opt.Task)
taskPrefix := "AWS:ECR"
p := opt.PipelineCfg
j := opt.JobCfg
actionCMDs := opt.ActionCommands
switch taskSelector {
case "PUSH":
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 := NewTaskAWSECR(c, actionCMDs, &opt, actionPrefix)
// New action to execute (mapped to the --task passed from the command line)
a := NewAWSECRAction(t, actionPrefix)
// Run the action
_, err := a.Push()
if err != nil {
return err
}
}
return nil
}