Skip to content

ci: wrap yarn into a retrying loop

Administrator requested to merge main-dry-run/devx/ductape-yarn into main

Created by: jhchabran

Behold, duct tape to the rescue.

This wraps yarn install commands within a loop that check for the presence of "unexpected errors ..." that are announcing that some network / 500 error / whatever happened when requesting stuff on the registry.

If such an error is found, the script will run yarn again. If we did not find such an error, the script will simply exit, like it would do without the loop.

If we go over $MAX_TIMEOUT_IN_SECONDS the script will simply abort.

@sourcegraph/frontend-platform I know that a possible fix is coming in a few weeks, but this could at least stop the bleeding until then.

Test plan

main-dry-run

To test this locally, I botched the registry url in yarn.lock to reproduce the kind of errors we've been seeing in CI. Remember to wipe your ./node_modules folder before doing so, otherwise it won't be taken in account.

Merge request reports

Loading