aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-12-12 15:30:15 +0100
committerFlorin Coras <florin.coras@gmail.com>2024-12-12 19:59:24 +0000
commitea360b570bc9377c218e922e1438610468545a0e (patch)
tree7ec502f565e9ee286970291e4c6de5acb62ae2f1 /extras
parent2c4b699359b95e466f37eabcf4831ec3695a6e82 (diff)
hs-test: skip building images if no new changes
- skip building if new changes are .go, .sum, .mod, .txt, .test, IP address files or dotfiles Type: test Change-Id: Ib041a077fa34120e86ebb43cd19e50142ef01f16 Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras')
-rwxr-xr-xextras/hs-test/script/build_hst.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/extras/hs-test/script/build_hst.sh b/extras/hs-test/script/build_hst.sh
index b7580f5af7e..96a7214d705 100755
--- a/extras/hs-test/script/build_hst.sh
+++ b/extras/hs-test/script/build_hst.sh
@@ -5,6 +5,24 @@ if [ "$(lsb_release -is)" != Ubuntu ]; then
exit 1
fi
+LAST_STATE_FILE=".last_state_hash"
+
+# get current state hash
+current_state_hash=$(git status --porcelain | grep -vE '(/\.|/10|\.go$|\.sum$|\.mod$|\.txt$|\.test$)' | sha1sum | awk '{print $1}')
+
+if [ -f "$LAST_STATE_FILE" ]; then
+ last_state_hash=$(cat "$LAST_STATE_FILE")
+else
+ last_state_hash=""
+fi
+
+# compare current state with last state
+if [ "$current_state_hash" = "$last_state_hash" ]; then
+ echo "*** Skipping docker build - no new changes \
+(excluding .go, .txt, .sum, .mod, dotfiles, IP address files) ***"
+ exit 0
+fi
+
export VPP_WS=../..
OS_ARCH="$(uname -m)"
DOCKER_BUILD_DIR="/scratch/docker-build"
@@ -85,3 +103,5 @@ if [ "$images" != "" ]; then
# shellcheck disable=SC2086
docker rmi $images
fi
+
+echo "$current_state_hash" > "$LAST_STATE_FILE"