Skip to content

Commit 0f6dda3

Browse files
aparcarclaude
andcommitted
labnet: split maintainers from access, fetch keys from GitHub
Maintainers are notified via @user mentions in healthcheck issue bodies; access lists which GitHub users get SSH keys fetched from github.com/<user>.keys and authorized on the lab host. Both are stored without the @ prefix; the coordinator authorizes the union of all access entries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Paul Spooren <mail@aparcar.org>
1 parent 47b6f75 commit 0f6dda3

6 files changed

Lines changed: 51 additions & 59 deletions

File tree

.github/workflows/healthcheck.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ jobs:
178178
const issueTitle = "Healthcheck ${{ matrix.proxy }}/${{ matrix.device }}";
179179
const runUrl = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}";
180180
const isSuccess = "${{ job.status }}" === "success";
181+
const maintainers = ${{ toJSON(matrix.maintainers) }}.map(m => '@' + m).join(', ');
181182
182183
const failureBody = `
183184
### ❌ Healthcheck Failed
@@ -186,7 +187,7 @@ jobs:
186187
187188
- **Proxy**: \`${{ matrix.proxy }}\`
188189
- **Device**: \`${{ matrix.device }}\`
189-
- **Maintainers**: ${{ join(matrix.maintainers, ', ') }}
190+
- **Maintainers**: ${maintainers}
190191
191192
has **failed**. Please review the logs and investigate the issue.
192193

ansible/coordinator.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
- hosts: coordinator
22
become: true
3+
vars:
4+
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
35
tasks:
46
- name: Create a user account called labgrid-dev
57
user:
68
name: labgrid-dev
79
state: present
810

9-
- name: Add SSH keys to labgrid-dev based on labnet.yaml
11+
- name: Add SSH keys to labgrid-dev from GitHub
1012
authorized_key:
1113
user: labgrid-dev
1214
state: present
13-
key: "{{ item.value.sshkey }}"
14-
comment: "{{ item.key }}"
15-
loop: "{{ hostvars[inventory_hostname]['developers'] | dict2items | default([]) }}"
15+
key: "{{ lookup('url', 'https://github.com/' + item + '.keys', split_lines=false) }}"
16+
comment: "{{ item }}"
17+
loop: "{{ labnet.labs.values() | map(attribute='access') | flatten | unique | list }}"
1618

1719
- name: Add public SSH key of CI runner
1820
authorized_key:

ansible/lab.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- hosts: labs
22
become: true
3+
vars:
4+
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
35
tasks:
46
- name: Set hostname
57
hostname:
@@ -24,13 +26,13 @@
2426
- dialout
2527
- plugdev
2628

27-
- name: Add SSH keys to labgrid-dev based on labnet.yaml
29+
- name: Add SSH keys to labgrid-dev from GitHub
2830
authorized_key:
2931
user: labgrid-dev
3032
state: present
31-
key: "{{ hostvars[inventory_hostname]['developers'][item]['sshkey'] }}"
33+
key: "{{ lookup('url', 'https://github.com/' + item + '.keys', split_lines=false) }}"
3234
comment: "{{ item }}"
33-
loop: "{{ hostvars[inventory_hostname]['labs'][inventory_hostname]['developers'] | default([]) }}"
35+
loop: "{{ labnet.labs[inventory_hostname].access | default([]) }}"
3436

3537
- name: Set /etc/hosts
3638
lineinfile:
@@ -289,8 +291,6 @@
289291
mode: "0755"
290292
owner: labgrid-dev
291293
group: labgrid-dev
292-
vars:
293-
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
294294
notify:
295295
- Restart labgrid-coordinator
296296
tags:

ansible/playbook_labgrid.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- hosts: labs
22
become: true
3+
vars:
4+
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
35
tasks:
46
- name: Set hostname
57
hostname:
@@ -24,13 +26,13 @@
2426
- dialout
2527
- plugdev
2628

27-
- name: Add SSH keys to labgrid-dev based on labnet.yaml
29+
- name: Add SSH keys to labgrid-dev from GitHub
2830
authorized_key:
2931
user: labgrid-dev
3032
state: present
31-
key: "{{ hostvars[inventory_hostname]['developers'][item]['sshkey'] }}"
33+
key: "{{ lookup('url', 'https://github.com/' + item + '.keys', split_lines=false) }}"
3234
comment: "{{ item }}"
33-
loop: "{{ hostvars[inventory_hostname]['labs'][inventory_hostname]['developers'] | default([]) }}"
35+
loop: "{{ labnet.labs[inventory_hostname].access | default([]) }}"
3436

3537
- name: Set /etc/hosts
3638
lineinfile:
@@ -289,8 +291,6 @@
289291
mode: "0755"
290292
owner: labgrid-dev
291293
group: labgrid-dev
292-
vars:
293-
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
294294
notify:
295295
- Restart labgrid-coordinator
296296
tags:

docs/sharing-target-files.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ labs:
1010
proxy: labgrid-example
1111
hostkey: ssh-ed25519 AAAA...
1212
maintainers:
13-
- "@maintainer"
13+
- maintainer
14+
access:
15+
- maintainer
1416
devices:
1517
- linksys_e8450
1618
device_instances:

labnet.yaml

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ labs:
33
proxy: labgrid-aparcar
44
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPRn1GsHlmQ02c8aOsQrSKz0qtK6IEO7uTRjrrDOKai7
55
maintainers:
6-
- "@aparcar"
6+
- aparcar
7+
access:
8+
- aparcar
9+
- dangowrt
10+
- jonasjelonek
711
devices:
812
- openwrt_one
913
- bananapi_bpi-r4-lite
@@ -14,84 +18,83 @@ labs:
1418
# - glinet_gl-mt6000
1519
# - enterasys_ws-ap3710i
1620
# - ignitenet_ss-w2-ac2600
17-
developers:
18-
- aparcar
19-
- dangowrt
20-
- jonasjelonek
2121
labgrid-bastian:
2222
proxy: labgrid-bastian
2323
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGxdB8NmJRjrS9lztZDKld8OprqY5ELjZ7koQ3b5atLd
2424
maintainers:
25-
- "@bittorf"
25+
- bittorf
26+
access:
27+
- aparcar
2628
devices:
2729
- cznic_turris-omnia
2830
- tplink_tl-wdr4300-v1
29-
developers:
30-
- aparcar
3131
labgrid-blocktrron:
3232
proxy: labgrid-blocktrron
3333
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGLL+T3zunt13cl9ZSZZkc/W+tnvIENEB28x/VoU2QnV
3434
maintainers:
35-
- "@blocktrron"
35+
- blocktrron
36+
access:
37+
- aparcar
3638
devices:
3739
- hpe_msm460
3840
- tplink_tl-wr842n-v3
39-
developers:
40-
- aparcar
4141
labgrid-leinelab:
4242
proxy: labgrid-leinelab
4343
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILDEM6JDEorz8cURSX7fXOdKsLKMJZQpzccpSEKytjAf
4444
maintainers:
45-
- "@lemoer"
45+
- lemoer
46+
access:
47+
- aparcar
4648
devices:
4749
- tplink_tl-wr1043nd-v3
48-
developers:
49-
- aparcar
5050
labgrid-hsn:
5151
proxy: labgrid-hsn
5252
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP5kAZ/gVDTHp2rOWmybFSf+JFtoQJPH4KFE+lUGKH0c
5353
maintainers:
54-
- "@jonasjelonek"
54+
- jonasjelonek
55+
access:
56+
- aparcar
57+
- jonasjelonek
5558
devices:
5659
- genexis_pulse-ex400
5760
- bananapi_bpi-r64
5861
- bananapi_bpi-r4
5962
- glinet_gl-mt1300
6063
- linksys_e8450
6164
- tplink_tl-wr1043nd-v4
62-
developers:
63-
- aparcar
64-
- jonasjelonek
6565
labgrid-wigyori:
6666
proxy: labgrid-wigyori
6767
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINoXHDKDcWBZ5mj2GSiWomYzaqjaElFQiqmqM4c8K8Q3
6868
maintainers:
69-
- "@wigyori"
69+
- wigyori
70+
access:
71+
- wigyori
7072
devices:
7173
- linksprite_a10-pcduino
7274
- olimex_a10-olinuxino-lime
7375
- olimex_a20-olinuxino-micro
7476
- pine64_pine64-plus
7577
- xunlong_orangepi-2
7678
- xunlong_orangepi-zero2
77-
developers:
78-
- wigyori
7979
labgrid-hauke:
8080
proxy: labgrid-hauke
8181
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHuOU1Tc2XIpd8B3Oy+Hg1aHYL+L+IznbVvdCJ04wizX
8282
maintainers:
83-
- "@hauke"
83+
- hauke
84+
access:
85+
- hauke
8486
devices:
8587
- openwrt_one
86-
developers:
87-
- hauke
8888
labgrid-fcefyn:
8989
proxy: labgrid-fcefyn
9090
hostkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK0ANF89u6x2DjGv8wEZ6Yc07WjcV7QM4izgy4EwafYo
9191
maintainers:
92-
- "@francoriba"
93-
- "@ccasanueva7"
94-
- "@javierbrk"
92+
- francoriba
93+
- ccasanueva7
94+
- javierbrk
95+
access:
96+
- francoriba
97+
- aparcar
9598
devices:
9699
- linksys_e8450
97100
- openwrt_one
@@ -104,19 +107,3 @@ labs:
104107
- belkin_rt3200_3
105108
librerouter_librerouter-v1:
106109
- librerouter_1
107-
developers:
108-
- francoriba
109-
- aparcar
110-
developers:
111-
aparcar:
112-
sshkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDZTxjQ3/KTefKvsPlVBWz+ITD7dGWcOt8/C55ekd2VE
113-
dangowrt:
114-
sshkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDe6tUbVJW3bYUVCYyQQFpNrJ1wP5kzvEkCruSjyA6TM
115-
jonasjelonek:
116-
sshkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDy4T0osxR8yS4RjJcsMn3rSacKvNzu+ZRNfe2lXTSHS
117-
wigyori:
118-
sshkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG8vcHMKcl6W6OuzSdjOhQ0ZehtH+McjLB7WzgP9P4Ls
119-
hauke:
120-
sshkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhbJDeGBfpn8vkd1wjHgOWvN9WGWS3mRgqqFqNqgpNE
121-
francoriba:
122-
sshkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPaNY9LyGgQlwlMaWxSWq5xD++UGCJtdqxHPHDADFACi

0 commit comments

Comments
 (0)