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

dev/preview:build: Clean git repository before performing build #14156

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

mads-hartmann
Copy link
Contributor

@mads-hartmann mads-hartmann commented Oct 25, 2022

Description

It turns out that the "cache miss" we were seeing from Gitpod Workspaces is due to some of our packages being sensitive to a "dirty filesystem". As a temporary solution I'm using git clean (see comment in code) but we should go through each component and see if we can make sure it isn't impacted by the occurrence of files that we have in .gitignore (such as build folders) - I have created an issue (#14157) and proposed it for next week.

This PR also adds a few more build arguments to align with the Leeway invocation performed by Werft to make it easier to merge the two as part of https://github.com/gitpod-io/ops/issues/5894

Related Issue(s)

Fixes #13767

How to test

gcloud auth login --no-launch-browser
leeway run dev/preview:build

Release Notes

NONE

Documentation

N/A

Werft options:

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

# We should fix the package definitions so that they don't include these files in the hash.
#
# For now we're simply cleaning the repository by deleting all files that are in .gitignore.
git clean -dfX
Copy link
Contributor

@vulkoingim vulkoingim Oct 25, 2022

Choose a reason for hiding this comment

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

Let's do this only in werft, as otherwise it might nuke changes/files that have not been added yet if you run it from a ws

Suggested change
git clean -dfX
if [[ -n ${WERFT_SERVICE_HOST+x} ]]; then
git clean -dfX
fi

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 is only really needed outside of Werft though - I don't think it will remove changed files (will test), but you're right it would delete files that are not yet tracked by git! Let me see if I can't narrow it down to only cover "ignored files" ☺️

# The files were produced using "git clean -ndfX"
components_dir="$SCRIPT_PATH/../../../../components"
install_dir="$SCRIPT_PATH/../../../../install"
rm -rf \
Copy link
Contributor

Choose a reason for hiding this comment

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

😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an ephemeral workspace, what's the worst that could happen 😉 Kidding aside, I'm only okay with this because we're going to remove it soon when we fix the real issue in #14157 ☺️

@roboquat roboquat merged commit c87781b into main Oct 25, 2022
@roboquat roboquat deleted the mads/improve-cache-hit branch October 25, 2022 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preview: Improve cache-hit of dev/preview:build
3 participants