-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
51 lines (46 loc) · 1.09 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
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
const (
globSetting = "test_globs"
globEnv = "PLUGIN_TEST_GLOBS"
quarantineFileSetting = "quarantine_file"
quarantineFileEnv = "PLUGIN_QUARANTINE_FILE"
quarantineSetting = "fail_on_quarantine"
quarantineEnv = "PLUGIN_FAIL_ON_QUARANTINE"
)
func main() {
app := &cli.App{
Name: "harness-parse-test-reports",
Usage: "Harness plugin to parse test reports",
Action: run,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "test_globs",
EnvVars: []string{"PLUGIN_TEST_GLOBS"},
},
&cli.StringFlag{
Name: "quarantine_file",
EnvVars: []string{"PLUGIN_QUARANTINE_FILE"},
},
&cli.BoolFlag{
Name: "fail_on_quarantine",
EnvVars: []string{"PLUGIN_FAIL_ON_QUARANTINE"},
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
func run(c *cli.Context) error {
p := Plugin{
GlobPaths: c.String(globSetting),
QuarantineFile: c.String(quarantineFileSetting),
FailOnQuarantine: c.Bool(quarantineSetting),
}
return p.Exec()
}