Update configure-apt-mock.sh to enable parallelism
Description
This adds a few errors that happen when another update/install process is running in parallel. apt-get update doesn't handle race conditions well, and apt-get install has one as well.
This is pre-cursor to another change that enables parallelism in the packer templates to run the install-*.sh scripts parallel, as I mentioned in https://github.com/actions/runner-images/discussions/2320
On its own, this change does nothing, except maybe slightly increase reliability of image building.
Check list
- [n/a] Related issue / work item is attached
- [n/a] Tests are written (if applicable)
- [n/a] Documentation is updated (if applicable)
- [n/a] Changes are tested and related VM images are successfully generated
I have more extensive changes coming to actually enable parallelism. This PR is now weeks old, which doesn't bode well for the rest of my changes. Is there any interest from the actual team?
Thank you @xximwon , but I need someone "with write access" to approve this PR.
ping @subir0071 , looks like CI passed, mind approving/merging it?
Hi @fahhem , Kindly rebase your Pr, thanks
@vidyasagarnimmagaddi rebased, but nothing changed in the rebase so the diffs are the same.
@vidyasagarnimmagaddi thank you, looks like CI still passes!
@fahhem - Could you please check my comment and provide your response?
@subir0071 I'm sorry, but I can't find your comment? I don't see anything in my emails either
This pull request enhances error handling in the configure-apt-mock.sh script by adding additional checks for specific race conditions during apt operations. These changes aim to improve the reliability of the script when encountering transient errors.
Improvements to error handling:
images/ubuntu/scripts/build/configure-apt-mock.sh: Added checks for race conditions involving lock files and cache renaming duringaptoperations. These include:- Detecting errors related to
/var/lib/apt/lists/lockto ensure retries whenapt updatedoes not complete. - Handling errors related to renaming
/var/cache/apt/pkgcache.binand/var/cache/apt/srcpkgcache.binto address incompleteapt-getoperations.
- Detecting errors related to