-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
main.go
35 lines (30 loc) · 860 Bytes
/
main.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
package main
import (
"context"
"os"
"os/signal"
"syscall"
"github.com/argoproj/argo-workflows/v3/util/errors"
// load authentication plugin for obtaining credentials from cloud providers.
_ "k8s.io/client-go/plugin/pkg/client/auth"
"github.com/argoproj/argo-workflows/v3/cmd/argoexec/commands"
"github.com/argoproj/argo-workflows/v3/util"
)
func main() {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM)
defer stop()
err := commands.NewRootCommand().ExecuteContext(ctx)
if err != nil {
if exitError, ok := err.(errors.Exited); ok {
if exitError.ExitCode() >= 0 {
os.Exit(exitError.ExitCode())
} else {
os.Exit(137) // probably SIGTERM or SIGKILL
}
} else {
util.WriteTerminateMessage(err.Error()) // we don't want to overwrite any other message
println(err.Error())
os.Exit(64)
}
}
}