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>
This commit is contained in:
parent
2c4b699359
commit
ea360b570b
1
.gitignore
vendored
1
.gitignore
vendored
@ -145,6 +145,7 @@ compile_commands.json
|
||||
/extras/hs-test/.last_hst_ppid
|
||||
/extras/hs-test/.goimports.ok
|
||||
/extras/hs-test/summary/
|
||||
/extras/hs-test/.last_state_hash
|
||||
|
||||
# ./configure
|
||||
/CMakeFiles
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user