movementlabsxyz / movement

The Movement Network is a Move-based L2 on Ethereum.
Apache License 2.0
82 stars 65 forks source link

Avoid races in CD container builds over symbolic references in checkouts #819

Open mzabaluev opened 2 weeks ago

mzabaluev commented 2 weeks ago

Summary

Don't supply the symbolic GitHub reference name to the ref parameter of the checkout action in the build-push-container-all workflow jobs. The default behavior of actions/checkout would do the right thing, checking out the SHA of the triggering event, thereby avoiding races with concurrent pushes to the repository modifying the symbolic references.

l-monninger commented 2 weeks ago

@mzabaluev I believe this will cause it to check out detached heads when responding to a label event.

mzabaluev commented 2 weeks ago

@mzabaluev I believe this will cause it to check out detached heads when responding to a label event.

That may be actually the correct way to run: the symbolic branch head may have been pushed to another commit by the time the job runs, which has happened e.g. in https://github.com/movementlabsxyz/movement/actions/runs/11726835429/job/32668512421#step:2:215

I can restore the statements as well, but replace the .ref with .sha.