alexellis / alexellis/derek

Inconsistent fetching of commits

未關閉
#158 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Go
星號
820
分支
68
PR 合併指標
30 天內沒有已合併 PR

描述

Inconsistent error:
```
exit status 1
time="2020-07-24T10:05:39Z" level=fatal msg="Error getting commits for PR 44\nGET https://api.github.com/repos/martindekov/push2/pulls/44/commits: 401 Bad credentials []"
```
This error is here:
https://github.com/alexellis/derek/blob/16d7143de95fbc1516be7377b7388995a78b19c0/handler/pullrequest_handler.go#L242

And the function is:
https://github.com/alexellis/derek/blob/16d7143de95fbc1516be7377b7388995a78b19c0/handler/pullrequest_handler.go#L235

Things I went through while trying to make the error consistent and it didn't:
- [x] Using the same context across all Derek's code for the pull logic as the OAuth2 object has description that the client is valid as long as the context with which it was created is used
- [x] Check rate limits as per description https://docs.github.com/en/rest/reference/rate-limit#understanding-your-rate-limit-status since the DCO feature increases the number of API calls.

## Expected Behaviour

Every request for the commits has the same behavior on error or success.

## Current Behaviour

Requesting the commits in a PR is inconsistent and might fail.

## Possible Solution

In this case we can re-try the request. Possibly if the problem is in the access token we can revisit how we request the token, or fix the error flow of the token.

## Steps to Reproduce (for bugs)

1. Run derek
2. Start sending requests by opening PRs and adding commits with and without signature
3. Check that sometimes this error is present and commits cannot be fetched leading to the dco label and checks not being applied properly

## Context

This can potentially lead to inconsistency when checking for DCO as if the error is present and derek will fail to list the commits and recognize if there is unsigned one.

## Your Environment

- [ ] You're using the hosted Derek service

or

- [x] You host your own OpenFaaS cluster with Derek installed

* Docker version `docker version` (e.g. Docker 17.0.05 ):
N/A
* Are you using Docker Swarm or Kubernetes (FaaS-netes)?
N/A
* Operating System and version (e.g. Linux, Windows, MacOS):
N/A

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。