-
Notifications
You must be signed in to change notification settings - Fork 0
/
combo.graphml.erb
91 lines (81 loc) · 3.53 KB
/
combo.graphml.erb
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
<?xml version="1.0" ?>
<!-- This just produces a "pipeline of pipelines" or "value-stream" graph -->
<% rails_apps = ['site', 'admin', 'store'] %>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns">
<key id="name" for="node" attr.name="name" attr.type="string"></key>
<key id="type" for="node" attr.name="type" attr.type="string"></key>
<key id="template" for="node" attr.name="template" attr.type="string"></key>
<key id="action" for="edge" attr.name="action" attr.type="string"></key>
<key id="duration" for="edge" attr.name="duration" attr.type="integer"></key>
<graph id="G" edgedefault="directed">
<% rails_apps.each do | app | %>
<!-- <%=app %> nodes -->
<node id="<%=app %>_pipeline">
<data key="name"><%=app %></data>
<data key="type">pipeline</data>
<data key="template">rails_app</data>
</node>
<edge source="<%=app %>_pipeline" target="aggregate_pipeline">
<data key="action">triggers</data>
</edge>
<% if red_data %>
<% 10.times do %>
<edge source="<%=app %>_pipeline" target="aggregate_pipeline">
<data key="action">triggered</data>
<data key="duration"><%= Random.rand(5..30)%></data>
</edge>
<edge source="<%=app %>_pipeline" target="aggregate_pipeline">
<data key="action">triggered</data>
<data key="duration"><%= Random.rand(5..30)%></data>
</edge>
<edge source="<%=app %>_pipeline" target="aggregate_pipeline">
<data key="action">triggered</data>
<data key="duration"><%= Random.rand(5..30)%></data>
</edge>
<% end %>
<% end %>
<% end %>
<!-- Aggregate nodes -->
<node id="aggregate_pipeline">
<data key="name">aggregate</data>
<data key="type">pipeline</data>
<!-- no template -->
</node>
<edge source="aggregate_pipeline" target="<%= deployments.first %>_pipeline">
<data key="action">triggers</data>
</edge>
<% if red_data %>
<% 10.times do %>
<edge source="aggregate_pipeline" target="<%= deployments.first %>_pipeline">
<data key="action">triggered</data>
<data key="duration"><%= Random.rand(5..30)%></data>
</edge>
<% end %>
<% end %>
<% while deployments.size > 0 %>
<% environment = deployments.shift %>
<% next_environment = deployments[0] %>
<!-- Environment: <%= environment %>-->
<!-- Next: <%= next_environment %>-->
<!-- <%= environment %> nodes -->
<node id="<%= environment %>_pipeline">
<data key="name"><%= environment %></data>
<data key="type">pipeline</data>
<data key="template">deploy</data>
</node>
<% unless next_environment.nil? %>
<edge source="<%= environment %>_pipeline" target="<%= next_environment %>_pipeline">
<data key="action">triggers</data>
</edge>
<% if red_data %>
<% 10.times do %>
<edge source="<%= environment %>_pipeline" target="<%= next_environment %>_pipeline">
<data key="action">triggered</data>
<data key="duration"><%= Random.rand(5..30)%></data>
</edge>
<% end %>
<% end %>
<% end %>
<% end %>
</graph>
</graphml>