script: re-try apt-get if it fails with "Mirror sync in progress?"
What
Retry apt-get update in case of error.
Why
https://gitlab.com/tezos/tezos/-/jobs/8649249064
Apparently this is not uncommon : https://github.com/search?q=apt-get+update+Mirror+sync+in+progress&ref=opensearch&type=discussions
It seems the common answer is : "Retry later", and this is very much true also for our CI jobs as this error is transient.
How
I override the apt-get command adding a retry of 5 with exponential backoff
if I see this error happening.
aliasing the command forced me to drop sudo that it was there only because
of documentation purposes.
Manually testing the MR
It's tricky to test if this Mr actually fix the problem. I didn't find a way to trigger the error artificially. The reviewer should carefully inspect the shell script and make sure does not contain any mistakes. Then we can merge and see.
The CI ensure that al least this MR does not affect the tests in case of no errors.
This is s scheduled pipeline : https://gitlab.com/nomadic-labs/tezos/-/pipelines/1615908664
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR