Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix containerlab CI cleanup when no containers are running. #167

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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