|
2 | 2 |
|
3 | 3 | set -e -u |
4 | 4 |
|
5 | | -trap cleanup EXIT |
6 | | - |
7 | 5 | # first import docker image |
8 | | -if [ -f ./ubi-ppc64le.tar ] ; then |
9 | | - docker image load --input ubi-ppc64le.tar |
| 6 | +if [ -f ./pytorch-ubi-ppc64le.tar ] ; then |
| 7 | + docker image load --input pytorch-ubi-ppc64le.tar |
10 | 8 | docker image tag docker.io/pytorch/ubippc64le-builder:cpu-ppc64le docker.io/pytorch/ubippc64le-builder:cpu-ppc64le-main |
11 | 9 | rm -f ubi-ppc64le.tar |
12 | 10 | fi |
13 | 11 |
|
14 | 12 | token_file=registration-token.json |
15 | 13 |
|
16 | | -# Function to clean up and unregister the runner |
17 | | -cleanup() { |
18 | | - echo "Cleaning up temporary files..." |
19 | | - [ -f "$token_file" ] && rm -f "$token_file" |
20 | | - [ -f "runner-id.json" ] && rm -f "runner-id.json" |
21 | | - |
22 | | - echo "Unregistering the runner from GitHub..." |
23 | | - ACCESS_TOKEN="$(cat /run/runner_secret)" |
24 | | - runner_id=$(curl -s \ |
25 | | - -H "Accept: application/vnd.github.v3+json" \ |
26 | | - -H "Authorization: Bearer ${ACCESS_TOKEN}" \ |
27 | | - "https://api.github.com/repos/${OWNER}/${REPO}/actions/runners" | \ |
28 | | - jq --raw-output '.runners[] | select(.name=="'"${NAME}"'") | .id') |
29 | | - |
30 | | - if [ -n "$runner_id" ]; then |
31 | | - curl -s \ |
32 | | - -X DELETE \ |
33 | | - -H "Accept: application/vnd.github.v3+json" \ |
34 | | - -H "Authorization: Bearer ${ACCESS_TOKEN}" \ |
35 | | - "https://api.github.com/repos/${OWNER}/${REPO}/actions/runners/$runner_id" |
36 | | - echo "Runner unregistered successfully." |
37 | | - else |
38 | | - echo "Warning: Runner ID for ${NAME} not found. It may already be removed." |
39 | | - fi |
40 | | - |
41 | | - unset ACCESS_TOKEN runner_id |
42 | | -} |
43 | | - |
44 | 14 | # Fetch GitHub access token |
45 | 15 | if [ ! -f /run/runner_secret ]; then |
46 | 16 | echo "Error: Access token file not found at /run/runner_secret." |
47 | 17 | exit 1 |
48 | 18 | fi |
49 | 19 |
|
50 | | - |
51 | 20 | ACCESS_TOKEN="$(cat /run/runner_secret)" |
52 | 21 |
|
53 | 22 | # Generate registration token |
|
60 | 29 |
|
61 | 30 | unset ACCESS_TOKEN |
62 | 31 |
|
| 32 | +rm -f /run/runner_secret |
| 33 | + |
63 | 34 | # register runner as ephemeral runner |
64 | 35 | # it does one job, stops and unregisters |
65 | 36 | registration_token=$(jq --raw-output .token "$token_file") |
|
0 commit comments