-
Notifications
You must be signed in to change notification settings - Fork 37
/
main.go
57 lines (47 loc) · 1.37 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"errors"
"os"
"os/exec"
libhoney "github.com/honeycombio/libhoney-go"
)
// Version will be set by CircleCI based on a git tag and the commit hash
var Version = "dev"
const (
providerTravis = "Travis-CI"
providerCircle = "CircleCI"
providerGitLab = "GitLab-CI"
providerBuildkite = "Buildkite"
providerJenkinsX = "Jenkins-X"
providerGoogleCloudBuild = "Google-Cloud-Build"
providerAzurePipelines = "Azure-Pipelines"
providerGitHubActions = "GitHub-Actions"
providerBitbucketPipelines = "Bitbucket-Pipelines"
)
func main() {
defer libhoney.Close()
var config libhoney.Config
var filename string
var ciProvider string
var wcfg watchConfig
var serviceName string
root := commandRoot(&config, &filename, &ciProvider, &serviceName)
// Put 'em all together
root.AddCommand(
commandBuild(&config, &filename, &ciProvider),
commandStep(&config, &filename, &ciProvider),
commandCmd(&config, &filename, &ciProvider),
commandWatch(&config, &filename, &ciProvider, &wcfg),
)
// Do the work
if err := root.Execute(); err != nil {
libhoney.Close()
// If the underlying command returned a specific exit code, we need
// to exit it with it as well to act transparently.
var cmdErr *exec.ExitError
if errors.As(err, &cmdErr) {
os.Exit(cmdErr.ExitCode())
}
os.Exit(1)
}
}