Skip to content

Commit 52a5796

Browse files
committed
Add workflow for enabling 16 Hetzner ARM64 runners
- Add infrastructure-hetzner-runners.yml workflow - Creates 4x cax41 servers with 4 runners each (16 total) - Restricted to igorpecovnik only - Uses armbian/actions/hetzner@testing for server management - Automatic cleanup after configurable time period - Configurable via env vars: MACHINE, MACHINE_COUNT, RUNNER_COUNT, PERIOD
1 parent 8365712 commit 52a5796

1 file changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: "Infrastructure: Enable 16 Hetzner ARM64 runners"
2+
on:
3+
workflow_dispatch:
4+
5+
concurrency:
6+
group: hetzner-runner
7+
cancel-in-progress: false
8+
9+
jobs:
10+
# Main jobs
11+
Teamcheck:
12+
permissions:
13+
actions: write
14+
if: |
15+
github.repository_owner == 'Armbian' &&
16+
github.actor == 'igorpecovnik'
17+
runs-on: Linux
18+
steps:
19+
20+
- name: "Check membership"
21+
uses: armbian/actions/team-check@main
22+
with:
23+
ORG_MEMBERS: ${{ secrets.ORG_MEMBERS }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
TEAM: "Release manager"
26+
27+
Prepare:
28+
needs: Teamcheck
29+
name: "Prepare matrix"
30+
outputs:
31+
matrix: ${{steps.matrix.outputs.matrix}}
32+
runs-on: Linux
33+
steps:
34+
35+
- name: Generate matrix
36+
id: matrix
37+
run: |
38+
count=${{ env.MACHINE_COUNT || '4' }}
39+
echo "Generating matrix for ${count} server(s)"
40+
matrix=$(seq 0 $(( count - 1 )) | jq -cnR '[inputs | tonumber]')
41+
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
42+
echo "Matrix: ${matrix}"
43+
44+
Create:
45+
name: "Server ${{ matrix.index }}"
46+
runs-on: ubuntu-latest
47+
needs: Prepare
48+
if: |
49+
github.repository_owner == 'Armbian' &&
50+
github.actor == 'igorpecovnik'
51+
timeout-minutes: 10
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
index: ${{fromJson(needs.Prepare.outputs.matrix)}}
56+
steps:
57+
58+
- name: Create Hetzner server
59+
uses: armbian/actions/hetzner@main
60+
with:
61+
action: create
62+
server-type: "${{ env.MACHINE || 'cax41' }}"
63+
index: "${{ matrix.index }}"
64+
delete-existing: "true"
65+
ssh-key: "UPLOAD"
66+
hetzner-token: ${{ secrets.HETZNER_ONE }}
67+
github-token: ${{ secrets.HETZNER_RUNNER }}
68+
runner-count: "${{ env.RUNNER_COUNT || '4' }}"
69+
70+
Work:
71+
name: "Work ${{ matrix.index }}"
72+
runs-on: Linux
73+
needs: [Prepare, Create]
74+
if: |
75+
github.repository_owner == 'Armbian' &&
76+
github.actor == 'igorpecovnik'
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
index: ${{fromJson(needs.Prepare.outputs.matrix)}}
81+
steps:
82+
- name: Sleep until cleanup
83+
run: sleep "${{ env.PERIOD || '60m' }}"
84+
85+
Cleaning:
86+
name: "Cleanup ${{ matrix.index }}"
87+
runs-on: ubuntu-latest
88+
needs: [Prepare, Create, Work]
89+
if: |
90+
always() &&
91+
github.repository_owner == 'Armbian' &&
92+
github.actor == 'igorpecovnik'
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
index: ${{fromJson(needs.Prepare.outputs.matrix)}}
97+
steps:
98+
- name: Delete Hetzner server
99+
uses: armbian/actions/hetzner@main
100+
with:
101+
action: delete
102+
server-type: "${{ env.MACHINE || 'cax41' }}"
103+
index: "${{ matrix.index }}"
104+
hetzner-token: ${{ secrets.HETZNER_ONE }}

0 commit comments

Comments
 (0)