Skip to content

Commit

Permalink
Add restart runner functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Shyam Jesal <s.jesalpura@gmail.com>
  • Loading branch information
shyamjesal committed Mar 25, 2021
1 parent 6d49d40 commit 3a3eb53
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scripts/github_runner/start_runners.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ]; then
echo "Parameters missing"
echo "USAGE: start_runners.sh <num of runners> https://github.com/<OWNER>/<REPO> <Github Access key> <runner label(comma separated)>"
echo "USAGE: start_runners.sh <num of runners> https://github.com/<OWNER>/<REPO> <Github Access key> <runner label(comma separated)> [restart]"
exit -1
fi

Expand All @@ -48,10 +48,18 @@ RUNNER_TOKEN="$(curl -XPOST -fsSL \
docker pull vhiveease/integ_test_runner
docker pull vhiveease/cri_test_runner



for number in $(seq 1 $1)
do
case "$4" in
"integ")

if [ "$5" == "restart" ]; then
docker container stop $(docker ps --format "{{.Names}}" | grep integration_test-github_runner)
docker container rm $(docker ps -a --format "{{.Names}}" | grep integration_test-github_runner)
fi

# create access token as mentioned here (https://github.com/myoung34/docker-github-actions-runner#create-github-personal-access-token)
CONTAINERID=$(docker run -d --restart always --privileged \
--name "integration_test-github_runner-${number}" \
Expand All @@ -65,6 +73,11 @@ do
vhiveease/integ_test_runner)
;;
"cri")

if [ "$5" == "restart" ]; then
kind get clusters | while read line ; do kind delete cluster --name "$line" ; done
fi

kind create cluster --image vhiveease/cri_test_runner --name "cri-test-github-runner-${number}"
sleep 2m
docker exec -it \
Expand Down

0 comments on commit 3a3eb53

Please sign in to comment.