File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
.github/scripts/ppc64le/self-hosted-builder Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ StartLimitIntervalSec=0
77[Service]
88Type =simple
99Restart =always
10+
11+ # Cleanup stale containers
12+ ExecStartPre =-/usr/bin/docker rm --force actions-runner.%i || true
13+
1014ExecStartPre =-/usr/bin/docker rm --force actions-runner.%i
1115ExecStartPre =-/usr/local/bin/gh_token_generator.sh /etc/actions-runner/%i/appid.env /etc/actions-runner/%i/installid.env /etc/actions-runner/%i/key_private.pem /etc/actions-runner/%i/ghtoken.env
1216ExecStartPre =-/usr/local/bin/gh_cat_token.sh /etc/actions-runner/%i/ghtoken.env /etc/actions-runner/%i/ghtoken.txt
@@ -28,6 +32,8 @@ ExecStop=/bin/sh -c "docker exec actions-runner.%i kill -INT -- -1"
2832ExecStop =/bin/sh -c "docker wait actions-runner.%i"
2933ExecStop =/bin/sh -c "docker rm actions-runner.%i"
3034
35+ ExecStop =/usr/bin/env rm -f /etc/actions-runner/%i/ghtoken.env /etc/actions-runner/%i/ghtoken.txt
36+
3137# Logging and Permissions
3238StandardOutput =journal
3339StandardError =journal
Original file line number Diff line number Diff line change @@ -49,3 +49,12 @@ rm -f "$token_file"
4949
5050# Run one job.
5151./run.sh
52+
53+ # Unregister runner after completion
54+ ACCESS_TOKEN=" $( cat /run/runner_secret) "
55+ curl \
56+ -X DELETE \
57+ -H " Accept: application/vnd.github.v3+json" \
58+ -H " Authorization: Bearer ${ACCESS_TOKEN} " \
59+ " https://api.github.com/repos/${OWNER} /${REPO} /actions/runners/$( jq --raw-output .id < runner-id.json) "
60+ unset ACCESS_TOKEN
You can’t perform that action at this time.
0 commit comments