diff --git a/engine/vcs/github/client_status.go b/engine/vcs/github/client_status.go index d781efe638..f6feaa9ccf 100644 --- a/engine/vcs/github/client_status.go +++ b/engine/vcs/github/client_status.go @@ -65,6 +65,8 @@ func (g *githubClient) SetStatus(ctx context.Context, event sdk.Event) error { } buf := bytes.NewBuffer(b) + log.Debug("SetStatus> github post on %v body:%v", path, string(b)) + res, err := g.post(path, "application/json", buf, nil) if err != nil { return sdk.WrapError(err, "Unable to post status") @@ -77,6 +79,8 @@ func (g *githubClient) SetStatus(ctx context.Context, event sdk.Event) error { return sdk.WrapError(err, "Unable to read body") } + log.Debug("SetStatus> github response for %v body:%v", path, string(body)) + if res.StatusCode != 201 { return sdk.WrapError(err, "Unable to create status on github. Status code : %d - Body: %s - target:%s", res.StatusCode, body, data.urlPipeline) } diff --git a/engine/vcs/github/http.go b/engine/vcs/github/http.go index a9cd6b8875..77f1c91945 100644 --- a/engine/vcs/github/http.go +++ b/engine/vcs/github/http.go @@ -143,12 +143,12 @@ func (c *githubClient) post(path string, bodyType string, body io.Reader, opts * req.Header.Add("Accept", "application/json") if opts.asUser && c.token != "" { req.SetBasicAuth(c.username, c.token) + log.Debug("Github API>> Request URL %s with basicAuth username:%v len:%d", req.URL.String(), c.username, len(c.token)) } else { req.Header.Add("Authorization", fmt.Sprintf("token %s", c.OAuthToken)) + log.Debug("Github API>> Request URL %s with Authorization", req.URL.String()) } - log.Debug("Github API>> Request URL %s", req.URL.String()) - return httpClient.Do(req) }