-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathgenerate-tracker-csv.go
100 lines (89 loc) · 2.41 KB
/
generate-tracker-csv.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
import (
"bytes"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
)
// Build a CSV for import to Pivotal Tracker by uncommenting the track you'd like to output
func main() {
if len(os.Args) < 2 {
log.Fatalf("Usage: %s local|oss", os.Args[0])
}
trackName := os.Args[1]
var modules []string
switch trackName {
case "labs":
modules = []string{
// Just the labs
"onboarding_lite_labs_app_metrics.prolific",
"onboarding_lite_labs_log_store.prolific",
"onboarding_lite_labs_metric_store.prolific",
}
case "local":
modules = []string{
// Onboarding Part 1: Local Track / developer experience / step-by-step
"introduction_local.prolific",
"deploy_local.prolific",
"app_development_local.prolific",
"routing_deep_dive.prolific",
"services_redis_cups.prolific",
"authorization.prolific",
"networking_monitoring.prolific",
"concourse.prolific",
"opsman.prolific",
"kubernetes.prolific",
"projects.prolific",
"onboarding_lite_labs_app_metrics.prolific",
"onboarding_lite_labs_log_store.prolific",
"onboarding_lite_labs_metric_store.prolific",
}
case "oss":
modules = []string{
//// Onboarding Part 2: OSS Track / operator & CF developer experience / guided exploration
"introduction.prolific",
"deploy_oss.prolific",
"app_development.prolific",
"feedback.prolific",
"routing_deep_dive.prolific",
"services_redis_cups.prolific",
"networking_monitoring.prolific",
"bosh_troubleshooting.prolific",
"concourse.prolific",
"opsman.prolific",
"kubernetes.prolific",
"projects.prolific",
"clean_up.prolific",
}
default:
log.Fatalf("Unrecognized track type '%s', only 'local' and 'oss' are support", trackName)
}
workingDir, err := os.Getwd()
if err != nil {
panic(err)
}
outputFile, err := os.Create(filepath.Join(workingDir, "onboarding-tracker.csv"))
if err != nil {
panic(err)
}
defer outputFile.Close()
for i, module := range modules {
moduleFilePath := filepath.Join(workingDir, module)
cmd := exec.Command("prolific", moduleFilePath)
cmd.Stderr = os.Stderr
csvContent, err := cmd.Output()
if err != nil {
log.Fatalf("Failed to run prolific: %s", err)
}
if i != 0 {
csvContent = bytes.TrimLeft(csvContent, "Title, Type, Description, Labels,Task\n")
}
_, err = outputFile.Write(csvContent)
if err != nil {
log.Fatal(err)
}
}
fmt.Printf("Generating CSV with selected modules: %s", modules)
}