-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_runner
More file actions
executable file
·52 lines (44 loc) · 1.24 KB
/
Copy pathdeploy_runner
File metadata and controls
executable file
·52 lines (44 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
source .env
SERVER_NAME="runner"
export HCLOUD_TOKEN="$HCLOUD_TOKEN"
STREAM="stable" # or "testing", "next"
for ARCH in "arm" "x86"; do
echo "arch is: $ARCH"
make clean
make "runner_$ARCH.ign"
IGNITION_CONFIG="./runner_$ARCH.ign"
IMAGE_ID="$(hcloud image list \
--type=snapshot \
--architecture "$ARCH" \
--selector=os=fedora-coreos \
--output json \
| jq -r '.[0].id')"
OLD_SERVER_ID="$(hcloud server list \
--selector="name=$SERVER_NAME-$ARCH" \
--output json \
| jq -r '.[0].id')"
echo "$SERVER_NAME-$ARCH"
if [ -n $OLD_SERVER_ID ]; then
echo "Shutting down old runner: $OLD_SERVER_ID"
hcloud server shutdown \
--wait \
--wait-timeout 300s \
"$OLD_SERVER_ID"
echo "Deleting old runner"
hcloud server delete "$OLD_SERVER_ID"
fi;
SERVER_TYPE="cax11"
if [ "$ARCH" = "x86" ]; then
SERVER_TYPE="cx22"
fi
echo "Creating replacement runner: $SERVER_NAME-$ARCH"
hcloud server create \
--name "$SERVER_NAME-$ARCH" \
--type "$SERVER_TYPE" \
--datacenter "$DATACENTER" \
--image "$IMAGE_ID" \
--ssh-key "$SSH_KEY_ID" \
--label "name=$SERVER_NAME-$ARCH" \
--user-data-from-file "$IGNITION_CONFIG"
done;