diff options
Diffstat (limited to 'ops/besadii')
-rw-r--r-- | ops/besadii/main.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ops/besadii/main.go b/ops/besadii/main.go index 438dd91f5e8b..36e0b6e59fdd 100644 --- a/ops/besadii/main.go +++ b/ops/besadii/main.go @@ -17,9 +17,12 @@ import ( "log/syslog" "net/http" "os" + "os/exec" "strings" ) +var gitBin = "git" + // Represents an updated reference as passed to besadii by git // // https://git-scm.com/docs/githooks#pre-receive @@ -106,7 +109,7 @@ func triggerBuild(log *syslog.Writer, token, branch, commit string) { os.Exit(1) } - req.Header.Add("Authorization", "token " + token) + req.Header.Add("Authorization", "token "+token) req.Header.Add("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) @@ -159,6 +162,15 @@ func main() { os.Exit(1) } + // Before triggering builds, it is important that git + // update-server-info is run so that cgit correctly serves the + // repository. + err := exec.Command(gitBin, "update-server-info").Run() + if err != nil { + log.Alert("failed to run 'git update-server-info' for depot!") + os.Exit() + } + token, err := ioutil.ReadFile("/etc/secrets/srht-token") if err != nil { log.Alert("sourcehot token could not be read") |