Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitbucket] make less requests and fail on error #11651

Merged
merged 1 commit into from
Jul 27, 2022

Conversation

svenefftinge
Copy link
Member

@svenefftinge svenefftinge commented Jul 26, 2022

This PR makes the logic for finding a gitpod.yml sequential.
Currently, we run the gitpod.yml inference on every workspace start, which sends lots of requests (around 20) to the git provider in order to check for build files. Since this is a fallback mode that is only relevant in those cases where there is no .gitpod.yml I have changed the logic so it is sequential and only runs when really needed.

fixes #11649

How to test

Start workspaces on repositories with gitpod.yml and without.
Make sure the right gitpod.yml is used.

Release Notes

NONE

Werft options:

  • /werft with-preview

@svenefftinge svenefftinge requested a review from a team July 26, 2022 11:26
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Jul 26, 2022
@@ -15,10 +15,7 @@ export class BitbucketFileProvider implements FileProvider {
@inject(BitbucketApiFactory) protected readonly apiFactory: BitbucketApiFactory;

public async getGitpodFileContent(commit: Commit, user: User): Promise<MaybeContent> {
const yamlVersion1 = await Promise.all([
this.getFileContent(commit, user, ".gitpod.yml"),
this.getFileContent(commit, user, ".gitpod"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where all the API calls are coming from, but asking for .gitpod every time is unnecessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any metrics that would allow us to trace this? Could we add the metrics first to understand the source of these requests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we need to better understand why we run into the limit (atlassian says the limit is 1000/hour [1]). But we have customers sitting on a bad experience today and removing this call does make sense in anyway even if it doesn't help with the rate limit. So I'd like to go ahead with this change and follow up with investigation of the api calls.

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-sefftinge-bitbucket-failed-calls-11649.1 because the annotations in the pull request description changed
(with .werft/ from main)

@svenefftinge
Copy link
Member Author

Turns out that a lot of calls are coming from config inferrer

fixes [BitBucket] Failed calls to fetch `.gitpod.yml` are silently ignored #11649
@svenefftinge svenefftinge force-pushed the sefftinge/bitbucket-failed-calls-11649 branch from 77432ff to d7d1d0f Compare July 26, 2022 16:34
@svenefftinge svenefftinge marked this pull request as ready for review July 26, 2022 16:36
Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks sensible, but I frankly don't have sufficient context around this part of config resolution to know if there are skeletons. Adding hold in case you want to wait for a review from someone with more context.

/hold

@roboquat roboquat merged commit 9b87e64 into main Jul 27, 2022
@roboquat roboquat deleted the sefftinge/bitbucket-failed-calls-11649 branch July 27, 2022 11:38
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/S team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BitBucket] Failed calls to fetch .gitpod.yml are silently ignored
3 participants