Skip to content

fix: add some missing workspace updates #7790

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

Merged
merged 3 commits into from
Jul 14, 2023
Merged

fix: add some missing workspace updates #7790

merged 3 commits into from
Jul 14, 2023

Conversation

code-asher
Copy link
Member

@code-asher code-asher commented Jun 1, 2023

Fixes #7186. Probably. I was not able to reproduce with a template that had invalid credentials (I used the Heroku template) but I was able to reproduce with the Docker template by deleting my volumes (well I restarted my dev workspace which killed the volumes).

There were two issues:

  1. Sometimes a failed job does not have the workspace build type so no workspace update was published. Fix is to add that type to all workspace build failures (or at least all the ones I found).
  2. Sometimes a failed job does not have any state so again no workspace update was published as that is skipped when there is no state. Fix is to publish an update even when there is no state.

Comment on lines -760 to -637
if jobType.WorkspaceBuild.State == nil {
break
}
Copy link
Member Author

@code-asher code-asher Jun 1, 2023

Choose a reason for hiding this comment

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

I am not sure what exactly this was guarding against (is there a danger to updating with empty state, maybe it would remove any previous state but that might be desired?) so maybe removing it has some unintended consequences...it fixes the unit test I added though. Seems not all workspace build failures include state.

Copy link
Member Author

@code-asher code-asher Jun 2, 2023

Choose a reason for hiding this comment

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

I added it back but only gated the update behind it since that appears specifically for updating the state and I suppose we might not want to do that when no state was included (still not sure though) but we still want the publish.

@@ -1116,6 +1116,7 @@ func (r *Runner) failedJobf(format string, args ...interface{}) *proto.FailedJob
JobId: r.job.JobId,
Error: message,
ErrorCode: code,
Type: &proto.FailedJob_WorkspaceBuild_{},
Copy link
Member Author

@code-asher code-asher Jun 1, 2023

Choose a reason for hiding this comment

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

I was able to trigger this by using the Docker template, creating a workspace, deleting my Docker volumes, then trying to start the workspace again.

It does not seem to trigger through the unit test. Not yet sure how to make it take this code path.

@code-asher code-asher force-pushed the asher/send-failed branch 3 times, most recently from 36c2959 to 6fab6a2 Compare June 2, 2023 23:20
@code-asher code-asher marked this pull request as ready for review June 2, 2023 23:31
@code-asher code-asher requested a review from kylecarbs June 2, 2023 23:34
@github-actions github-actions bot added the stale This issue is like stale bread. label Jun 12, 2023
@matifali matifali removed the stale This issue is like stale bread. label Jun 12, 2023
@github-actions github-actions bot added the stale This issue is like stale bread. label Jun 28, 2023
@github-actions github-actions bot closed this Jul 1, 2023
@code-asher code-asher reopened this Jul 14, 2023
There are some failure cases where we do not set the type as a workspace
build which causes the workspace update to never be published.
Otherwise the associated test fails due to the logger fataling on
error messages.
@code-asher code-asher merged commit 7ed17b2 into main Jul 14, 2023
@code-asher code-asher deleted the asher/send-failed branch July 14, 2023 23:07
@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server/API is not sending event to workspace/watch when it is failed
3 participants