Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/healthcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ jobs:
const issueTitle = "Healthcheck ${{ matrix.proxy }}/${{ matrix.device }}";
const runUrl = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}";
const isSuccess = "${{ job.status }}" === "success";
const maintainers = ${{ toJSON(matrix.maintainers) }}.map(m => '@' + m).join(', ');

const failureBody = `
### ❌ Healthcheck Failed
Expand All @@ -186,7 +187,7 @@ jobs:

- **Proxy**: \`${{ matrix.proxy }}\`
- **Device**: \`${{ matrix.device }}\`
- **Maintainers**: ${{ join(matrix.maintainers, ', ') }}
- **Maintainers**: ${maintainers}

has **failed**. Please review the logs and investigate the issue.

Expand Down
10 changes: 6 additions & 4 deletions ansible/coordinator.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
- hosts: coordinator
become: true
vars:
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
tasks:
- name: Create a user account called labgrid-dev
user:
name: labgrid-dev
state: present

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

- name: Add public SSH key of CI runner
authorized_key:
Expand Down
10 changes: 5 additions & 5 deletions ansible/lab.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
- hosts: labs
become: true
vars:
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
tasks:
- name: Set hostname
hostname:
Expand All @@ -24,13 +26,13 @@
- dialout
- plugdev

- name: Add SSH keys to labgrid-dev based on labnet.yaml
- name: Add SSH keys to labgrid-dev from GitHub
authorized_key:
user: labgrid-dev
state: present
key: "{{ hostvars[inventory_hostname]['developers'][item]['sshkey'] }}"
key: "{{ lookup('url', 'https://github.com/' + item + '.keys', split_lines=false) }}"
comment: "{{ item }}"
loop: "{{ hostvars[inventory_hostname]['labs'][inventory_hostname]['developers'] | default([]) }}"
loop: "{{ ((labnet.labs[inventory_hostname].maintainers | default([])) + (labnet.labs[inventory_hostname].access | default([]))) | unique | list }}"

- name: Set /etc/hosts
lineinfile:
Expand Down Expand Up @@ -289,8 +291,6 @@
mode: "0755"
owner: labgrid-dev
group: labgrid-dev
vars:
labnet: "{{ lookup('file', '../labnet.yaml') | from_yaml }}"
notify:
- Restart labgrid-coordinator
tags:
Expand Down
Loading
Loading