Repository navigation
Raise error when using container has not been executed - #4716
Merged
Merged
Conversation
helderco
approved these changes
Mar 7, 2023
helderco
left a comment
Contributor
There was a problem hiding this comment.
LGTM 👍
Running example in #4668 ends in:
panic: input:1: container.build.exitCode no command has been executed
Please visit https://dagger.io/help#go for troubleshooting guidance.
...
exit status 2Previously exitCode, stdout, and stderr would simply return null if a container had not been executed yet, i.e. a container that's really just an image. Worse, this would actually get turned into the zero-value for each in the Go SDK (0, "", "") making it look like a successful exec. Additionally, it was easy to accidentally use an un-exec'd container as a service, e.g. by running an off-the-shelf redis or postgres image. You'd get a weird error with an empty hostname. Now in all cases we'll raise an error when trying to use a container that has never exec'd. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Contributor
Author
|
Merging optimistically, but leaving the door open for more bikeshedding later. I think this is a net benefit with services around the corner. I just ran into this gotcha while working on my own demo and the error let me figure it out pretty quickly (obvious caveat that I'm the one that added it, but it's strictly better than no error). |
This was referenced Apr 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously
exitCode,stdout, andstderrwould simply return null if a container had not been executed yet, i.e. a container that's really just an image. Worse, this would actually get turned into the zero-value for each in the Go SDK (0,"") making it look like a successful exec.Additionally, it was easy to accidentally use an un-exec'd container as a service, e.g. by running an off-the-shelf
redisorpostgresimage without includingWithExec(nil). You'd get a weird error with an empty hostname.Now in all cases we'll raise an error when trying to use a container that has never exec'd.
fixes #4668