Kubernetes executor: write attach-mode stage scripts atomically

What does this MR do?

Kubernetes executor: write attach-mode stage scripts atomically

The attach strategy writes each stage script to a shared emptyDir via one exec, then a separately-attached shell reads it back by path. generateSaveScript wrote straight to the final path (touch; chmod; echo > path) — non-atomic — so under load the reading shell could observe the file missing or partially written, failing with "No such file or directory" and hanging the job until its timeout.

Write to .tmp then atomically rename into place so the reader only ever sees the complete file.

Why was this MR needed?

#39644

What's the best way to test this MR?

The underlying issue is very hard to replicate as it happens during high loads on the cluster

What are the relevant issue numbers?

Edited by Cyprian Bergonia

Merge request reports

Loading
Loading