github-pr-resource icon indicating copy to clipboard operation
github-pr-resource copied to clipboard

Close #26: Filter PRs by updated date instead of commit date

Open ctreatma opened this issue 4 years ago • 11 comments

This supersedes #205.

This resource can inadvertently miss Pull Requests due to out-of-order commits across PRs. If PR#2 is opened after PR#1, but the head commit of PR#2 is older than the head commit of PR#1, the resource will not include PR#2 in the list of new versions provided to Concourse.

In #205, I removed the date filter entirely. This ensures that the PR resource will find all PRs that match the explicitly-configured filters. While Concourse can detect and ignore duplicate versions, it has to run a database query for every version returned by a check, so removing the date filter entirely would increase load on a Concourse database. (That said, I'm not sure whether this increased load is a particular concern, and other resources don't seem to make much effort to avoid returning duplicate versions from a check.)

To avoid that extra load on a Concourse database, this change instead replaces the filter by commit date in check.go with a filter by updated date in the GraphQL query to list pull requests. This should reduce the number of duplicate versions returned by a check while still allowing the PR resource to detect PRs with out-of-order head commits.

ctreatma avatar Jun 08 '21 20:06 ctreatma

Hi,

Thanks for the contribution, when I get the time, I'll see if these changes resolve our issues. I had the same implementation in private branch of this, but I made the mistake of digging myself a hole trying to make some of the queries optional for other features.

But going back to the basics is a great idea. Do you have an image available of this ready to be tested?

rickardl avatar Aug 11 '21 21:08 rickardl

@rickardl Can this be addressed sooner, I have bunch of PRs opened some time back and label added today not triggering build.

Pasupathi-Rajamanickam avatar Aug 12 '21 21:08 Pasupathi-Rajamanickam

I'm somewhat waiting for a confirmation that this resolves the issue, I haven't seen a result from the test suite being run here.

rickardl avatar Aug 22 '21 11:08 rickardl

GitHub says it's not going to run the tests for this PR until a maintainer approves them.

ctreatma avatar Aug 23 '21 14:08 ctreatma

Hello, I made my own docker image based on this PR, and it solved our issue, the PR that wasn't seen by the CI, even with fake git commit is now seen correctly and has been processed by our CI :tada: Thanks for this patch ! :heart:

Seraf avatar Aug 24 '21 09:08 Seraf

Hello, any news on this one?

Seraf avatar Sep 14 '21 14:09 Seraf

I'm tired of waiting, test is still running, people are yelling. Started to write my own PR resource. 😂

Pasupathi-Rajamanickam avatar Sep 14 '21 14:09 Pasupathi-Rajamanickam

Is there any update on this? We are facing the same issue.

prabhathsys avatar Oct 06 '21 21:10 prabhathsys

Is there any way a maintainer can allow the test jobs to run so we can confirm if this PR is mergeable? I ran the tests locally and they passed, but they won't run in GitHub unless a maintainer approves them.

ctreatma avatar Dec 10 '21 17:12 ctreatma

Any updates on this? I'm pretty sure this passes all of the tests, but I the PR checks won't run unless a maintainer allows them to run. We continue to run into this issue on a regular basis and would prefer to have an official release with the fix rather than running a fork.

ctreatma avatar Mar 31 '22 14:03 ctreatma

@ctreatma Thank you for this fix, I decided it will be faster to just get your commit and push own image to docker repository and use that instead of telia-oss. And now PR''s are fetched correctly

cached avatar Oct 04 '22 20:10 cached