Yi Tseng | aae6ef5 | 2021-09-01 13:48:27 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation. |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | set -euo pipefail |
| 5 | SSH_PORT=${SSH_PORT:-2222} |
| 6 | THIS_DIR="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)" |
| 7 | TEST_ON_DIR="$(cd ${THIS_DIR}/.. && pwd)" |
| 8 | |
| 9 | function cleanup() { |
| 10 | echo "Stopping TestON container" |
| 11 | docker stop teston |
| 12 | } |
| 13 | trap cleanup EXIT |
| 14 | |
| 15 | echo "Starting TestON container..." |
| 16 | |
| 17 | docker run -d --rm --init --name teston \ |
| 18 | -p $SSH_PORT:22 \ |
| 19 | -v $TEST_ON_DIR:/home/jenkins/teston \ |
| 20 | teston |
| 21 | |
| 22 | echo "SSH server listen on $SSH_PORT" |
| 23 | echo "Attaching to the container..." |
| 24 | docker exec -it -u jenkins teston bash -c "cd /home/jenkins && bash" |