mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Merge pull request #32043 from ClickHouse/better_worker_scripts
Better scripts for runners
This commit is contained in:
commit
e80ff2c0c5
@ -1,20 +1,34 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
echo "Running init script"
|
echo "Running init script"
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
export RUNNER_HOME=/home/ubuntu/actions-runner
|
export RUNNER_HOME=/home/ubuntu/actions-runner
|
||||||
|
|
||||||
echo "Receiving token"
|
|
||||||
export RUNNER_TOKEN=`/usr/local/bin/aws ssm get-parameter --name github_runner_registration_token --with-decryption --output text --query Parameter.Value`
|
|
||||||
export RUNNER_URL="https://github.com/ClickHouse"
|
export RUNNER_URL="https://github.com/ClickHouse"
|
||||||
# Funny fact, but metadata service has fixed IP
|
# Funny fact, but metadata service has fixed IP
|
||||||
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
|
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
|
||||||
|
|
||||||
cd $RUNNER_HOME
|
while true; do
|
||||||
|
runner_pid=`pgrep run.sh`
|
||||||
|
echo "Got runner pid $runner_pid"
|
||||||
|
|
||||||
echo "Going to configure runner"
|
cd $RUNNER_HOME
|
||||||
sudo -u ubuntu ./config.sh --url $RUNNER_URL --token $RUNNER_TOKEN --name $INSTANCE_ID --runnergroup Default --labels 'self-hosted,Linux,X64,builder' --work _work
|
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`
|
||||||
|
|
||||||
echo "Run"
|
echo "Will try to remove runner"
|
||||||
sudo -u ubuntu ./run.sh
|
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,builder' --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
|
||||||
|
@ -1,20 +1,34 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
echo "Running init script"
|
echo "Running init script"
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
export RUNNER_HOME=/home/ubuntu/actions-runner
|
export RUNNER_HOME=/home/ubuntu/actions-runner
|
||||||
|
|
||||||
echo "Receiving token"
|
|
||||||
export RUNNER_TOKEN=`/usr/local/bin/aws ssm get-parameter --name github_runner_registration_token --with-decryption --output text --query Parameter.Value`
|
|
||||||
export RUNNER_URL="https://github.com/ClickHouse"
|
export RUNNER_URL="https://github.com/ClickHouse"
|
||||||
# Funny fact, but metadata service has fixed IP
|
# Funny fact, but metadata service has fixed IP
|
||||||
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
|
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
|
||||||
|
|
||||||
cd $RUNNER_HOME
|
while true; do
|
||||||
|
runner_pid=`pgrep run.sh`
|
||||||
|
echo "Got runner pid $runner_pid"
|
||||||
|
|
||||||
echo "Going to configure runner"
|
cd $RUNNER_HOME
|
||||||
sudo -u ubuntu ./config.sh --url $RUNNER_URL --token $RUNNER_TOKEN --name $INSTANCE_ID --runnergroup Default --labels 'self-hosted,Linux,X64,func-tester' --work _work
|
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`
|
||||||
|
|
||||||
echo "Run"
|
echo "Will try to remove runner"
|
||||||
sudo -u ubuntu ./run.sh
|
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,func-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
|
||||||
|
@ -1,20 +1,34 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
echo "Running init script"
|
echo "Running init script"
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
export RUNNER_HOME=/home/ubuntu/actions-runner
|
export RUNNER_HOME=/home/ubuntu/actions-runner
|
||||||
|
|
||||||
echo "Receiving token"
|
|
||||||
export RUNNER_TOKEN=`/usr/local/bin/aws ssm get-parameter --name github_runner_registration_token --with-decryption --output text --query Parameter.Value`
|
|
||||||
export RUNNER_URL="https://github.com/ClickHouse"
|
export RUNNER_URL="https://github.com/ClickHouse"
|
||||||
# Funny fact, but metadata service has fixed IP
|
# Funny fact, but metadata service has fixed IP
|
||||||
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
|
export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
|
||||||
|
|
||||||
cd $RUNNER_HOME
|
while true; do
|
||||||
|
runner_pid=`pgrep run.sh`
|
||||||
|
echo "Got runner pid $runner_pid"
|
||||||
|
|
||||||
echo "Going to configure runner"
|
cd $RUNNER_HOME
|
||||||
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
|
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`
|
||||||
|
|
||||||
echo "Run"
|
echo "Will try to remove runner"
|
||||||
sudo -u ubuntu ./run.sh
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user