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