-
Notifications
You must be signed in to change notification settings - Fork 3
/
uncommitted-changes.sh
executable file
·28 lines (23 loc) · 995 Bytes
/
uncommitted-changes.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
#!/usr/bin/env bash
set -e
BUILD_REASON="${BUILD_REASON:-local}"
BRANCH="${BRANCH:-$(git rev-parse --abbrev-ref HEAD)}"
echo "Build reason: ${BUILD_REASON}"
echo "Source branch: ${BRANCH}"
CHANGED_DERIVED=$(git diff --name-status -- strimzi amq-streams debezium metrics open-data-hub)
GENERATED_FILES=$(git ls-files --other --exclude-standard -- strimzi amq-streams debezium metrics open-data-hub)
if [ -n "$CHANGED_DERIVED" ] || [ -n "$GENERATED_FILES" ] ; then
if [ -n "$CHANGED_DERIVED" ] ; then
echo "ERROR: Uncommitted changes in derived resources:"
echo "$CHANGED_DERIVED"
fi
if [ -n "$GENERATED_FILES" ] ; then
echo "ERROR: Uncommitted changes in generated resources:"
echo "$GENERATED_FILES"
fi
echo "Run the following to add up-to-date resources:"
echo " make \\"
echo " && git add strimzi amq-streams debezium metrics open-data-hub \\"
echo " && git commit -s -m 'Update derived resources'"
exit 1
fi