Publish workflow invocation workspace status event sooner (take 2) #6691
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.
Publish the workspace status sooner, but only if
commit_sha
is known. Otherwise, wait until we sync the repo (to get the resolved HEAD commit SHA), but log a warning.The warning focuses on the reproducibility benefits (making sure the build happens at an exact commit SHA), even though this PR is focused on the UX benefit of showing results in the UI sooner. I figured the reproducibility benefit might be a better selling point for getting people to set the commit_sha.
(Original context from #6529)
WorkspaceStatus is one of the events that prevents us from writing the Invocation row to the DB (due to the code here and here), meaning the UI will be stuck in "Invocation is in progress..." state while we are cloning the git repo. This PR moves the WorkspaceStatus event to be published before attempting to sync the git repo, so that we can get a nicer invocation page sooner even if the git repo sync is taking longer than usual.
Verified by adding an artificial 10s sleep to ws.setup() locally, and checking that this results in "Invocation in progress..." state being displayed for at least 10s, while after the fix, we can see the full invocation page while the sleep is happening.
Related issues: N/A