ClickHouse/tests/ci/worker/init_stress_tester.sh

35 lines
1.1 KiB
Bash
Raw Normal View History

2021-11-01 10:27:46 +00:00
#!/usr/bin/env bash
2021-12-01 09:39:09 +00:00
set -uo pipefail
2021-11-01 10:27:46 +00:00
echo "Running init script"
export DEBIAN_FRONTEND=noninteractive
export RUNNER_HOME=/home/ubuntu/actions-runner
export RUNNER_URL="https://github.com/ClickHouse"
# Funny fact, but metadata service has fixed IP
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
2021-12-01 09:39:09 +00:00
while true; do
runner_pid=`pgrep run.sh`
echo "Got runner pid $runner_pid"
2021-11-01 10:27:46 +00:00
2021-12-01 09:39:09 +00:00
cd $RUNNER_HOME
if [ -z "$runner_pid" ]; then
echo "Receiving token"
RUNNER_TOKEN=`/usr/local/bin/aws ssm get-parameter --name github_runner_registration_token --with-decryption --output text --query Parameter.Value`
2021-11-01 10:27:46 +00:00
2021-12-01 09:39:09 +00:00
echo "Will try to remove runner"
sudo -u ubuntu ./config.sh remove --token $RUNNER_TOKEN ||:
echo "Going to configure runner"
sudo -u ubuntu ./config.sh --url $RUNNER_URL --token $RUNNER_TOKEN --name $INSTANCE_ID --runnergroup Default --labels 'self-hosted,Linux,X64,stress-tester' --work _work
echo "Run"
sudo -u ubuntu ./run.sh &
sleep 15
else
echo "Runner is working with pid $runner_pid, nothing to do"
sleep 10
fi
done