Skip to content

Conversation

filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Nov 5, 2024

Description

Whenever we try to parse the context for a workspace, we check that any Dockerfile mentioned in the .gitpod.yml's image.file actually exists and we also check when it was last modified.

The problem is that for most providers, we did the existence check by listing commits for the given path, which gave false-positives for Dockerfiles that once existed but no longer do on the tip of the git reference.

In addition, we now don't let this error block workspace starts. Instead, we attach a warning to the workspace metadata and show it in the UI when starting.

Related Issue(s)

Follow-up for CLC-851 and #20267

How to test

You can try parsing https://github.com/spring-projects/spring-petclinic on the preview environment. It should let you create a workspace, but with a warning.

@geropl
Copy link
Member

geropl commented Nov 6, 2024

Thank you for the PR, @filiptronicek !

I do see the error now, but really wonder whether that is the right way to go about it:
image

Ideally, I would see this "warning", but still be able to start he workspace with the default image... which is the behavior we had before, no? Or has that been changed by the recent changes around surfacing parsing errors? 🤔

@filiptronicek
Copy link
Member Author

@geropl I agree, we should not force folks to get stuck when they make a mistake. This check is helpful in that it allows us to tell the user at what actually is wrong. This was the previous state:
image

@filiptronicek
Copy link
Member Author

filiptronicek commented Nov 6, 2024

@meysholdt reported this as a bug and as far as our current feature set goes, it is. It is not a hard error to fix even outside of Gitpod with web-native editors inside every SCM, but it would be great if supervisor could know about this condition and report it appropriately.

gp validate is very helpful here, but we've seen folks who just don't want to use it:

gitpod /workspace/spring-petclinic (main) $ gp validate
Your .gitpod.yml points to a Dockerfile that doesn't exist: /workspace/spring-petclinic/.devcontainer/Dockerfile

I'm going to put this back to draft and see what other options we have.

Edit: it looks like supervisor does really only get the exit status, this will be tricky...

@roboquat roboquat added size/L and removed size/M labels Nov 7, 2024
@filiptronicek filiptronicek marked this pull request as ready for review November 7, 2024 10:05
@filiptronicek filiptronicek requested a review from a team as a code owner November 7, 2024 10:05
forceCreateNewWorkspace?: boolean;
forceImageBuild?: boolean;
// The context can have non-blocking warnings that should be displayed to the user.
warnings?: string[];
Copy link
Member

Choose a reason for hiding this comment

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

🧡

if err != nil {
log.WithError(err).Error("build failed")

err := os.WriteFile("/workspace/.gitpod/bob.log", []byte(err.Error()), 0644)
Copy link
Member

Choose a reason for hiding this comment

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

🧡

}

if (ExternalImageConfigFile.is(config.config.image)) {
if (config.config.image.externalSource.revision === "") {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Made it happen in fbd4b35 (#20345). I agree that it's better to have a special value.

@geropl
Copy link
Member

geropl commented Nov 7, 2024

Really like this change: Thoroughly thought through, fixed the underlying issue on all fronts we can consider, plus introducing a super-useful concept for context-parsing in general. 🧡

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Code LGTM tested and works as advertised! 🎉

@filiptronicek filiptronicek self-assigned this Nov 7, 2024
@roboquat roboquat merged commit 65e3f09 into main Nov 7, 2024
32 checks passed
@roboquat roboquat deleted the ft/fix-currently-missing-dockerfiles branch November 7, 2024 13:13
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.

3 participants