Skip to content

Commit

Permalink
Docker images cleanup at start.
Browse files Browse the repository at this point in the history
- Cleanup docker images at start to free disk space. Otherwise it can happen that the invokers do not allow action execution as the free disk space is less than 85% during the tests.
- In case of an error during system test, add the controller and invoker logs to the build output.
  • Loading branch information
falkzoll committed Aug 15, 2023
1 parent 03ce08c commit ea598cc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
distribution: 'temurin'
java-version: 8

- name: Docker Images Cleanup
run: |
df -h
docker image ls
docker image rm $(docker image ls -q) -f
df -h
- name: befor install -> docker.sh
run: ./tools/travis/docker.sh

Expand All @@ -53,7 +60,11 @@ jobs:
# run: ./tools/travis/runUnitTests.sh && ./tools/travis/checkAndUploadLogs.sh unit db

- name: script -> System Tests
run: ./tools/travis/runSystemTests.sh && ./tools/travis/checkAndUploadLogs.sh system
run: |
df -h \
&& ./tools/travis/runSystemTests.sh \
&& df-h \
&& ./tools/travis/checkAndUploadLogs.sh system
#- name: script -> Multi-Runtime Tests
# run: ./tools/travis/runMultiRuntimeTests.sh && ./tools/travis/checkAndUploadLogs.sh multi-runtime
Expand Down
4 changes: 4 additions & 0 deletions tools/travis/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ sudo gpasswd -a travis docker
sudo usermod -aG docker travis
#sudo -E bash -c 'echo '\''DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --storage-driver=overlay --userns-remap=default"'\'' > /etc/default/docker'

# change default data directory for docker to /mnt/docker (in githubactions)
sudo mkdir -p /mnt/docker
sudo -E bash -c 'echo '\''DOCKER_OPTS="-g /mnt/docker"'\'' > /etc/default/docker'

# Docker
sudo apt-get clean
sudo apt-get update
Expand Down
1 change: 1 addition & 0 deletions tools/travis/runSystemTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#

set -e
set -x

SCRIPTDIR=$(cd $(dirname "$0") && pwd)
ROOTDIR="$SCRIPTDIR/../.."
Expand Down
17 changes: 16 additions & 1 deletion tools/travis/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

set -e
set -x

# Build script for Travis-CI.

Expand All @@ -26,7 +27,21 @@ ROOTDIR="$SCRIPTDIR/../.."

cd $ROOTDIR
cat whisk.properties
TERM=dumb ./gradlew :tests:testCoverageLean :tests:reportCoverage :tests:testSwaggerCodegen
( # run this in a subshell to get the result code but not terminating the process to print the logs.
set +e
TERM=dumb ./gradlew :tests:testCoverageLean :tests:reportCoverage :tests:testSwaggerCodegen

if [[ "$?" != "0" ]]; then
# debugging notes
# || true; set -x; docker ps -a; for i in $(docker ps -a --format="{{.Names}}"); do docker logs $i || true; done; ls -alhR /tmp/wsklogs;
# || true; set -x; docker ps -a; ls -R /tmp/wsklogs ;cat /tmp/wsklogs/invoker0/invoker0_logs.log; cat /tmp/wsklogs/controller0/controller0_logs.log;

set -x # show the following commands in the output
cat /tmp/wsklogs/invoker0/invoker0_logs.log
cat /tmp/wsklogs/controller0/controller0_logs.log
exit 1
fi
)

bash <(curl -s https://codecov.io/bash)
echo "Time taken for ${0##*/} is $SECONDS secs"

0 comments on commit ea598cc

Please sign in to comment.