forked from spring-cloud/stream-applications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-matrices.sh
executable file
·66 lines (64 loc) · 1.44 KB
/
create-matrices.sh
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
#!/bin/bash
function add_app() {
if ((COUNT > 0)); then
echo "," >> matrix.json
fi
echo "\"$1\"" >> matrix.json
COUNT=$((COUNT+1))
TOTAL=$((TOTAL+1))
}
pushd applications/processor > /dev/null
PROCESSORS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd applications/sink > /dev/null
SINKS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd applications/source > /dev/null
SOURCES=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd functions/consumer > /dev/null
CONSUMERS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd functions/function > /dev/null
FUNCTIONS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd functions/supplier > /dev/null
SUPPLIERS=$(find * -maxdepth 0 -type d)
popd > /dev/null
TOTAL=0
echo "{" > matrix.json
echo "\"functions\":[" >> matrix.json
COUNT=0
for app in $FUNCTIONS; do
add_app $app
done
echo "],\"consumers\":[" >> matrix.json
COUNT=0
for app in $CONSUMERS; do
add_app $app
done
echo "],\"suppliers\":[" >> matrix.json
COUNT=0
for app in $SUPPLIERS; do
add_app $app
done
echo "],\"processors\":[" >> matrix.json
COUNT=0
for app in $PROCESSORS; do
add_app $app
done
echo "],\"sinks\":[" >> matrix.json
COUNT=0
for app in $SINKS; do
add_app $app
done
echo "],\"sources\":[" >> matrix.json
COUNT=0
for app in $SOURCES; do
add_app $app
done
echo "]" >> matrix.json
echo ",\"count\": $TOTAL" >> matrix.json
echo "}" >> matrix.json
MATRIX=$(jq -c . matrix.json)
echo "$MATRIX" > matrix.json