Introduce retry mechanism for npm install in CI/CD
This commit addresses occasional pipeline failures caused by transient network errors during dependency installation with `npm ci`. It centralizes the logic for installing npm dependencies and introduces a retry mechanism. The new approach will attempt `npm ci` up to 5 times with a 5-second interval between each attempt, thereby increasing the resilience of CI/CD pipelines. This commit adds a new script `npm-install.js` with `npm run install-deps` command to centralize npm dependency installation process throughout the project. Separate testing of scripts to a separate workflow. It removes unused `install` dependency from `package.json`.
This commit is contained in:
@@ -13,8 +13,8 @@ See [ci-cd.md](./ci-cd.md) for more information.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Install node >15.x.
|
||||
- Install dependencies using `npm install`.
|
||||
- Install Node >16.x.
|
||||
- Install dependencies using `npm install` (or [`npm run install-deps`](#utility-scripts) for more options).
|
||||
|
||||
### Testing
|
||||
|
||||
@@ -73,9 +73,9 @@ See [ci-cd.md](./ci-cd.md) for more information.
|
||||
|
||||
#### Utility scripts
|
||||
|
||||
- [**`./scripts/fresh-npm-install.sh`**](../scripts/fresh-npm-install.sh):
|
||||
- Run fresh NPM install.
|
||||
- This script provides a clean NPM install, removing existing node modules and optionally the package-lock.json (when run with -n), then installs dependencies and runs unit tests.
|
||||
- [**`npm run install-deps [-- <options>]`**](../scripts/npm-install.js):
|
||||
- Manages NPM dependency installation, it offers capabilities like doing a fresh install, retries on network errors, and other features.
|
||||
- For example, you can run `npm run install-deps -- --fresh` to do clean installation of dependencies.
|
||||
- [**`./scripts/configure-vscode.sh`**](../scripts/configure-vscode.sh):
|
||||
- This script checks and sets the necessary configurations for VSCode in `settings.json` file.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user