-
Notifications
You must be signed in to change notification settings - Fork 1
/
getfloes.go
68 lines (47 loc) · 1.56 KB
/
getfloes.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
package customfloe
import (
"floe/tasks"
triggers "floe/triggers"
f "floe/workflow/flow"
"time"
)
func getLocalFlows(p *f.Project) {
p.AddTriggerFlow(p.MakeTriggerLauncher("triggered flow", FirstFlowFunc))
spaceFlow := &workSpaceFlow{
repo: "danmux",
branch: "master",
}
spaceFlow.Init("couch riak etcd")
spaceFlowLauncher := f.MakeFlowLauncher(spaceFlow, 1, nil, nil)
p.AddFlow(spaceFlowLauncher)
localWorkspaceFlow := &localWorkspaceFlow{
repo: "danmux",
branch: "development",
}
localWorkspaceFlow.Init("local workspace")
// p.AddFlow(f.MakeFlowLauncher(localWorkspaceFlow, 1, spaceFlowLauncher, triggerFlowLauncher))
p.AddFlow(f.MakeFlowLauncher(localWorkspaceFlow, 1, spaceFlowLauncher, nil))
}
func FirstFlowFunc(threadId int) *f.Workflow {
w := f.MakeWorkflow()
t1 := w.MakeTriggerNode("wait 14", triggers.MakeDelayTrigger(14*time.Second))
t2 := w.MakeTriggerNode("wait 12", triggers.MakeDelayTrigger(12*time.Second))
hip_start := w.MakeTaskNode("ping hipchat", tasks.MakeDelayTask(5*time.Second))
co := w.MakeTaskNode("git checkout", tasks.MakeDelayTask(15*time.Second))
last := w.MakeTaskNode("finish", tasks.MakeDelayTask(5*time.Second))
tpush := w.MakeTriggerNode("push floeit pages", triggers.MakeGitPushTrigger("[email protected]:floeit/floeit.github.io.git", "", 10))
hip_start.AddNext(0, co)
co.AddNext(0, last)
t1.AddNext(0, co)
t2.AddNext(0, hip_start)
tpush.AddNext(0, co)
w.SetEnd(last)
return w
}
func GetFlows(env string) *f.Project {
p := f.MakeProject("V3")
if env == "local" {
getLocalFlows(p)
}
return p
}