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

topotests: Allow runing under both docker and podman #17525

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tests/topotests/docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# Copyright 2018 Network Device Education Foundation, Inc. ("NetDEF")

cd "$(dirname "$0")"/..

exec docker build --pull \
exec $(command -v docker || command -v podman) build --pull \
--compress \
-t frrouting/topotests:latest \
.
10 changes: 6 additions & 4 deletions tests/topotests/docker/frr-topotests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# Copyright 2018 Network Device Education Foundation, Inc. ("NetDEF")
Expand Down Expand Up @@ -113,10 +113,12 @@ if [ -z "$TOPOTEST_FRR" ]; then
git -C "$TOPOTEST_FRR" ls-files -z > "${TOPOTEST_LOGS}/git-ls-files"
fi

cmd="$(command -v docker || command -v podman)"

if [ -z "$TOPOTEST_BUILDCACHE" ]; then
TOPOTEST_BUILDCACHE=topotest-buildcache
docker volume inspect "${TOPOTEST_BUILDCACHE}" &> /dev/null \
|| docker volume create "${TOPOTEST_BUILDCACHE}"
"${cmd}" volume inspect "${TOPOTEST_BUILDCACHE}" &> /dev/null \
|| "${cmd}" volume create "${TOPOTEST_BUILDCACHE}"
fi

if [[ -n "$TMUX" ]]; then
Expand Down Expand Up @@ -145,4 +147,4 @@ if [ -t 0 ]; then
set -- -t "$@"
fi

exec docker run "$@"
exec "${cmd}" run "$@"
Loading