oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package heartbeat
2
3import (
4 "amadan.net/oficina/equipo/internal/runnerproto"
5 "crypto/rand"
6)
7
8func Request(reports []runnerproto.ConnectionReport, repositories func() ([]string, error)) (runnerproto.HeartbeatRequest, error) {
9 raw, err := runnerproto.Marshal(reports)
10 if err != nil {
11 return runnerproto.HeartbeatRequest{}, err
12 }
13 names := []string{}
14 if repositories != nil {
15 names, err = repositories()
16 // Failed discovery withdraws previous names rather than retaining stale access.
17 if err != nil {
18 names = []string{}
19 }
20 }
21 return runnerproto.HeartbeatRequest{Version: 2, RequestID: rand.Text(), Reports: raw, Repositories: names}, nil
22}
23