-
Notifications
You must be signed in to change notification settings - Fork 0
/
arch_review_helper.sh
executable file
·69 lines (60 loc) · 2 KB
/
arch_review_helper.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
67
68
69
#!/bin/bash
function clean_tmp {
rm -rf /tmp/{old,new}
mkdir /tmp/{old,new}
}
function switch_branch {
echo "Switching branch to \"$1\""
pushd architecture > /dev/null
git checkout $1 1> /dev/null 2> /dev/null
BRANCH=$1
popd > /dev/null
}
function check_branch {
pushd architecture > /dev/null
BRANCH=$(git branch --show-current)
if [[ $BRANCH == "main" ]]; then
echo "Aborting: first check out the branch you want to compare to main"
exit 1
else
echo "Comparing \"$BRANCH\" against \"main\" for VA1"
fi
popd > /dev/null
}
function build_va1 {
# building CRs in $TARGET as described here
# https://github.com/openstack-k8s-operators/architecture/tree/main/examples/va/hci
TARGET=$1
echo "Building va1 in $TARGET of branch \"$BRANCH\""
# control-plane
pushd architecture/examples/va/hci > /dev/null
kustomize build control-plane/nncp > $TARGET/nncp.yaml
kustomize build control-plane > $TARGET/control-plane.yaml
# dataplane-pre-ceph
kustomize build edpm-pre-ceph/nodeset > $TARGET/dataplane-nodeset-pre-ceph.yaml
kustomize build edpm-pre-ceph/deployment > $TARGET/dataplane-deployment-pre-ceph.yaml
# post-ceph
kustomize build > $TARGET/nodeset-post-ceph.yaml
kustomize build deployment > $TARGET/deployment-post-ceph.yaml
tree $TARGET
popd > /dev/null
}
# -------------------------------------------------------
pushd ~/review/ > /dev/null
clean_tmp
check_branch
TESTED_BRANCH=$BRANCH
build_va1 /tmp/new
switch_branch main
build_va1 /tmp/old
switch_branch $TESTED_BRANCH
echo "Compare \"$TESTED_BRANCH\" in /tmp/new to \"main\" in /tmp/old"
echo ""
echo "diff -u /tmp/{old,new}/control-plane.yaml"
echo "diff -u /tmp/{old,new}/dataplane-deployment-pre-ceph.yaml"
echo "diff -u /tmp/{old,new}/dataplane-nodeset-pre-ceph.yaml"
echo "diff -u /tmp/{old,new}/deployment-post-ceph.yaml"
echo "diff -u /tmp/{old,new}/nncp.yaml"
echo "diff -u /tmp/{old,new}/nodeset-post-ceph.yaml"
echo ""
popd > /dev/null