forked from onosproject/build-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchart_single_check
executable file
·34 lines (27 loc) · 1002 Bytes
/
chart_single_check
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
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2018-present Open Networking Foundation <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
set -eu -o pipefail
modified_charts=$(git diff HEAD^ HEAD | grep Chart.yaml | grep -v /charts/ | grep +++ | cut -d " " -f2 | sed s^b/^^) || true
modified_component_charts=""
for chart in ${modified_charts}; do
git diff HEAD^ HEAD ${chart}
version=$(git diff HEAD^ HEAD ${chart} | grep +version: | cut -d " " -f2) || true
if [ ! -z ${version} ]; then
# figure out the tag for this chart
component=`echo ${chart} | cut -d "/" -f1`
modified_component_charts="${modified_component_charts} ${component}"
fi
done
if [ "${modified_component_charts}" = "" ]; then
echo No charts were modified
exit 0
fi
count=$(wc -w <<<${modified_component_charts})
count=${count//[[:blank:]]/}
if (( ${count} != 1 )); then
echo Found more than one modified chart: ${modified_component_charts}
exit 1
fi
exit 0