Repository navigation
Conversation
fa346cf to
dc894fb
Compare
This is a convenience API to replace this pattern:
```go
code, err := container.ExitCode(ctx)
if err != nil {
return err
}
if code != 0 {
return fmt.Errorf("exit code: %d", code)
}
```
Right now it's redundant because ExitCode returns an error when it
encounters a nonzero exit code, which is a bug (dagger#3192). Anyone relying
on that behavior and ignoring the code return value should switch to
this new API instead.
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
|
@helderco @slumbering I'm going to context-switch away from this for a bit, so if you have some downtime I'd appreciate any pointers (or commits) for updating the Python/NodeJS SDKs to handle the new |
|
It's on my radar. I don't have bandwidth right now but I want to think about this a little more soon. At a glance, I'd like to add not erroring on |
|
@helderco Thanks! No rush. 🙏
Chatted about this with @sipsma and this is where we landed: #3192 (comment) tl;dr The safest thing to me is to leave exit_code, stdout, and stderr erroring by default - or at least stdout. I can see the argument for stderr/exit_code not erroring by default (if you're asking for the exit code you might care about values other than |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
I think we should focus on getting a standardized solution to resolving lazyness: The synchronization convenience could raise an error on failure, either by default or by having a flag. Same as suggested in #3192 (comment) but I'd rather move away from using Not yet clear to me if a |
|
Just to update that I still have this on my mind, but I'm going to submit a different proposal soon. |
|
This looked to merge to me, but waiting on your thoughts @helderco before we push it through. |
TomChv
left a comment
There was a problem hiding this comment.
LGTM too, let me know when it's ready so I can also update the Typescript Client if necessary.
|
Please hold on as I have concerns. We do need to replace the |
|
As I understand it, we shouldn't use the GraphQL error for non-zero exit code in exec. It should be reserved for the inability to even run the command (e.g., command not configured, network error, etc...): In this situation, with GraphQL, people tend to return a custom "Error" type as the response value instead. Similarly to that, I've submitted a proposal that uses an object as value ( |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
Adds this API:
This is a convenience to replace this pattern:
with this:
I expect this to be used in a lot of pipelines that people write, so I biased towards what I think is a pretty ergonomic name ("run") even if it's a bit of a lie due to caching.
Right now this API is redundant because ExitCode returns an error when it encounters a nonzero exit code,
which is a bug (#3192). Anyone relying on that behavior and ignoring the exit code return value should switch to this new API instead to avoid silently dropping failures in the future. (edit: per #3192 (comment) it'll keep erroring by default, so don't fear breakage in the future, but this API is still nice for when you don't actually care about the exit code.)implementation notes
I added a new
Voidscalar return type because the entire point of this API is to not have a return value and just raise an error if the container fails. I updated the Go SDK codegen to handle this but haven't updated the rest yet. Submitting PR early for API review.