diff --git a/main.go b/main.go index 6450a18..1139a3b 100644 --- a/main.go +++ b/main.go @@ -113,7 +113,7 @@ func notifSummary(notification *GiteaNotification) string { return fmt.Sprintf("%s/%s:%s", notification.Repository.Owner.Username, notification.Repository.Name, notification.After) } -func lifecycle(notification *GiteaNotification, dispatch *nomad.JobDispatchResponse, giteaCreds *SecretGitea) { +func lifecycle(notification *GiteaNotification, dispatch *nomad.JobDispatchResponse, giteaCreds *SecretGitea, flavor string) { notifInfo := notifSummary(notification) log.Printf("[lifecycle] Commit to build: %s, Gitea URL: %s\n", notifInfo, giteaCreds.Url) @@ -158,7 +158,7 @@ func lifecycle(notification *GiteaNotification, dispatch *nomad.JobDispatchRespo gitea.CreateStatusOption{ State: state, TargetURL: GlobalConfig.AlbatrosURL + "/build?log=stderr&job=" + dispatch.DispatchedJobID, - Description: "build", + Description: flavor, Context: "Albatros", }) @@ -213,6 +213,7 @@ func hook(w http.ResponseWriter, r *http.Request) { pair, _, err := kv.Get(key, nil) if err != nil { http.Error(w, "Can't fetch the repo descriptor in Consul", http.StatusInternalServerError) + log.Printf("Job error for %s, can't fetch repo descriptor in consul: %+v\n", notifInfo, err) return } if pair == nil || pair.Value == nil { @@ -223,6 +224,7 @@ func hook(w http.ResponseWriter, r *http.Request) { var repoDesc ConsulSecret if err = json.Unmarshal(pair.Value, &repoDesc); err != nil { http.Error(w, "Can't decode your Consul configuration for this repo", http.StatusInternalServerError) + log.Printf("Job error for %s, can't unmarshal the Consul descriptor: %+v\n", notifInfo, err) return } // Check token @@ -256,7 +258,7 @@ func hook(w http.ResponseWriter, r *http.Request) { log.Printf("Created job %s for %s\n", dres.DispatchedJobID, notifInfo) // Start a lifecycle observer to update gitea status - go lifecycle(¬ification, dres, &repoDesc.Gitea) + go lifecycle(¬ification, dres, &repoDesc.Gitea, flavor) io.WriteString(w, dres.DispatchedJobID) }