forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.go
41 lines (36 loc) · 720 Bytes
/
init.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
37
38
39
40
41
package commands
import (
"github.com/argoproj/argo/util/stats"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(initCmd)
}
var initCmd = &cobra.Command{
Use: "init",
Short: "Load artifacts",
Run: func(cmd *cobra.Command, args []string) {
err := loadArtifacts()
if err != nil {
log.Fatalf("%+v", err)
}
},
}
func loadArtifacts() error {
wfExecutor := initExecutor()
defer wfExecutor.HandleError()
defer stats.LogStats()
// Download input artifacts
err := wfExecutor.StageFiles()
if err != nil {
wfExecutor.AddError(err)
return err
}
err = wfExecutor.LoadArtifacts()
if err != nil {
wfExecutor.AddError(err)
return err
}
return nil
}