gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
12.71k stars 1.21k forks source link

Gitpod resources are wasted by running multiple prebuild processes for same commit #14237

Open shaal opened 1 year ago

shaal commented 1 year ago

Bug description

Pushing a commit result in 3 (three!) separate prebuild processes for no apparent reason. image

https://gitpod.io/t/phase2/tufts-core/f3835ce4-aa28-4ab6-975a-7dc95d129e83 https://gitpod.io/t/phase2/tufts-core/f5862986-03e7-4268-87ea-fcaac8236931 https://gitpod.io/t/phase2/tufts-core/552b3fc5-c58f-4d23-ac52-af2ea71fd9b6

Steps to reproduce

  1. Add a repo to team/project, with gitpod.yml setup for Github prebuild.
  2. Push a commit
  3. Check the prebuild pages and see that multiple prebuilds are running (usually 2) https://gitpod.io/t/team/project/prebuilds

Workspace affected

No response

Expected behavior

No response

Example repository

No response

Anything else?

No response

AlexTugarev commented 1 year ago

Thanks for reporting @shaal!

This is not what we expect to happen. I did a quick look at the webhook event registered, and see 3 distinct events:

|creationTime            |type        |authorizedUserId                    |rawEvent             |
|------------------------|------------|------------------------------------|---------------------|
|2022-10-27T13:46:47.363Z|pull_request|A                                   |                     |
|2022-10-27T13:46:45.764Z|push        |A                                   |w/ installation id   |
|2022-10-27T13:46:45.592Z|push        |B                                   |w/o installation id  |

The pull_request event is slipped through despite https://github.com/gitpod-io/gitpod/pull/13295, which is reasonable if different server pods handled the requests.

The new issue here is, the two push events look like they've been produced by two webhooks. While one is from the GH App, where is origin of the second event?

@shaal, do you have a change to inspect the Webhooks page for the phase2/tufts-core repository?

AlexTugarev commented 1 year ago

Following the current trend, a holistic way to solve this issue would be to move triggering of prebuilds into a control loop which would query the DB for recently recorded webhook events.

Also pull_request events should not trigger a prebuild at all. To clarify, there are two types of PRs which would be registered in those events. If the source repository is the same as the current target, a push event would also be registered. If the source is a different repository, we'd likely expect Gitpod would be configured there as well.

shaal commented 1 year ago

@AlexTugarev I noticed this is still happening image

Where should I look? The example in the screenshot is from a branch with no PR. I pushed code to Github, and I see that 2 prebuilds are running in parallel.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

shaal commented 10 months ago

This is still happening

Konard commented 10 months ago

image

I have the same issue again, please reopen the issue.

Konard commented 10 months ago

this repeats again

IMG_1685

loujaybee commented 10 months ago

Related internal issue.