Skip to content

Commit

Permalink
Fix containerlab CI cleanup when no containers are running. (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Jun 11, 2024
1 parent 27aedbf commit 003f018
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/ci-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ set -e
echo "Cleanup artifacts of previous runs"

# containerlab will figure out previous run locations from the docker containers
previous_topos=$(docker inspect -f '{{ index .Config.Labels "clab-topo-file" }}' $(docker ps -aq))
for topo in previous_topos; do
previous_lab_dir=$(dirname $topo)
mkdir -p "${previous_lab_dir}/clab-mini-lab"
done
running_containers=$(docker ps -aq)

if [ ! -z "$running_containers" ]; then
previous_topos=$(docker inspect -f '{{ index .Config.Labels "clab-topo-file" }}' $(docker ps -aq))
for topo in previous_topos; do
previous_lab_dir=$(dirname $topo)
mkdir -p "${previous_lab_dir}/clab-mini-lab"
done
fi

make cleanup

Expand Down

0 comments on commit 003f018

Please sign in to comment.