forked from fediversity/fediversity
		
	picked up from https://git.fediversity.eu/Fediversity/Fediversity/compare/main...niols:forgejo-ci. closes #356. Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com> Reviewed-on: Fediversity/Fediversity#389 Reviewed-by: Nicolas Jeannerod <nicolas.jeannerod@moduscreate.com> Co-authored-by: Kiara Grouwstra <kiara@procolix.eu> Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/usr/bin/env sh
 | 
						|
set -euC
 | 
						|
 | 
						|
cd "$(dirname "$0")"
 | 
						|
 | 
						|
{
 | 
						|
cat <<\EOF
 | 
						|
<!-- This file is auto-generated by `machines.md.sh` from the machines'
 | 
						|
     configuration. -->
 | 
						|
 | 
						|
# Machines
 | 
						|
 | 
						|
Currently, this repository keeps track of the following VMs:
 | 
						|
 | 
						|
Machine | Proxmox | Description
 | 
						|
--------|---------|-------------
 | 
						|
EOF
 | 
						|
 | 
						|
vmOptions=$(
 | 
						|
  cd ..
 | 
						|
  nix eval \
 | 
						|
    --impure --raw --expr "
 | 
						|
      builtins.toJSON (builtins.getFlake (builtins.toString ../.)).vmOptions
 | 
						|
    " \
 | 
						|
    --log-format raw --quiet
 | 
						|
)
 | 
						|
 | 
						|
## NOTE: `jq`'s `keys` is alphabetically sorted, just what we want here.
 | 
						|
for machine in $(echo "$vmOptions" | jq -r 'keys[]'); do
 | 
						|
  if [ "${machine#test}" = "$machine" ]; then
 | 
						|
    proxmox=$(echo "$vmOptions" | jq -r ".$machine.proxmox")
 | 
						|
    description=$(echo "$vmOptions" | jq -r ".$machine.description" | head -n 1)
 | 
						|
 | 
						|
    # shellcheck disable=SC2016
 | 
						|
    printf '[`%s`](./dev/%s) | %s | %s\n' "$machine" "$machine" "$proxmox" "$description"
 | 
						|
  fi
 | 
						|
done
 | 
						|
 | 
						|
cat <<\EOF
 | 
						|
| `forgejo-ci` | n/a (physical) | Forgejo actions runner |
 | 
						|
 | 
						|
This table excludes all machines with names starting with `test`.
 | 
						|
EOF
 | 
						|
} >| machines.md
 |