Skip to content

gitpipe: Prioritize context cancellation

Patrick Steinhardt requested to merge pks-gitpipe-cancellation into master

We're observing flaky tests in our gitpipe code, where the race happens on context cancellation: we'll either see that the pipeline has shut down gracefully, or alternatively we'll see that git-rev-list(1) was killed because of context cancellation. This race can happen because we don't prioritize handling of context cancellations: if git-rev-list(1) was killed via the context, then it must've happened via our context and thus we know that at the point of sending the error down the pipeline, that the context has terminated already.

Fix the race by prioritizing context cancellation: before trying to send down any results or errors, we'll first check whether the context was cancelled. This also allows us to get rid of the workaround we had in our pipeline tests where there was a special child context such that we didn't observe killed git-cat-file(1) processes.

Fixes #3697 (closed), #3693 (closed)

Merge request reports