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

[server] Don't fetch the repository config a second time when starting incremental prebuilds #13962

Merged
merged 1 commit into from
Oct 19, 2022

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Oct 18, 2022

Description

Follow-up to #13801: Don't fetch the repository config a second time when starting incremental prebuilds

Related Issue(s)

Fixes #13801 (comment)

And this has the unfortunate consequence of calling fetchConfig twice now [1, 2]. This could be resolved by allowing to pass an optional config to findGoodBaseForIncrementalBuild.

How to test

  1. Incremental prebuilds should still work

Release Notes

NONE

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@jankeromnes jankeromnes changed the title [server] Don't fetch the repository config a second time when startin… [server] Don't fetch the repository config a second time when starting incremental prebuilds Oct 18, 2022
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-jx-fetch-config.1 because the annotations in the pull request description changed
(with .werft/ from main)

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Oct 18, 2022

Tested incremental prebuilds and they still work 🎉

@jankeromnes jankeromnes marked this pull request as ready for review October 18, 2022 16:28
@jankeromnes jankeromnes requested a review from a team October 18, 2022 16:28
@jankeromnes jankeromnes requested a review from geropl October 18, 2022 16:29
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Oct 18, 2022
Comment on lines 71 to 79
config?: WorkspaceConfig,
): Promise<PrebuiltWorkspace | undefined> {
if (!history.commitHistory || history.commitHistory.length < 1) {
return;
}

const { config } = await this.configProvider.fetchConfig({}, user, context);
if (!config) {
config = (await this.configProvider.fetchConfig({}, user, context)).config;
}
Copy link
Member

@easyCZ easyCZ Oct 18, 2022

Choose a reason for hiding this comment

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

We're always gonna fetch the config when it's not provided. Here, we can push that into caller and always require a config to be present on this call. The caller can do await this.configProvider.fetchConfig({}, user, context)).config to get it. It has the benefit of not hiding complexity and the method signature much better communicates the behaviour.

We only have another caller from gitpod-server-impl so it is a small change.

config: WorkspaceConfig,
    ): Promise<PrebuiltWorkspace | undefined> {
        if (!history.commitHistory || history.commitHistory.length < 1) {
            return;
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, thanks for the idea 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This implies injecting a ConfigProvider into GitpodServerImplEE, but I think that's okay and cleaner this way.

@jankeromnes
Copy link
Contributor Author

/hold for Milan's suggestion

@jankeromnes
Copy link
Contributor Author

Addressed

/unhold

@roboquat roboquat merged commit 53ad761 into main Oct 19, 2022
@roboquat roboquat deleted the jx/fetch-config branch October 19, 2022 08:58
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Oct 19, 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/XS team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants