-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.sh
More file actions
36 lines (27 loc) · 837 Bytes
/
go.sh
File metadata and controls
36 lines (27 loc) · 837 Bytes
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
#!/bin/sh
# Get the id of the runner (if exists)
id=$(curl --header \
"PRIVATE-TOKEN: $PERSONAL_ACCESS_TOKEN" \
"$GITLAB_INSTANCE/api/v4/runners" | python3 -c \
'
import sys, json;
json_data=json.load(sys.stdin)
for item in json_data:
if item["description"] == "'$RUNNER_NAME'":
print(item["id"])
')
echo "👋 id of $RUNNER_NAME runner is: $id"
echo "⚠️ trying to deactivate runner..."
curl --request DELETE --header \
"PRIVATE-TOKEN: $PERSONAL_ACCESS_TOKEN" \
"$GITLAB_INSTANCE/api/v4/runners/$id"
# Register, then run the new runner
echo "👋 launching new gitlab-runner"
gitlab-runner register --non-interactive \
--url "$GITLAB_INSTANCE/" \
--name $RUNNER_NAME \
--registration-token $TOKEN \
--executor shell
gitlab-runner run &
echo "🌍 executing the http server"
python3 -m http.server 8080