Skip to content

Commit 40198ac

Browse files
committed
RHAIENG-2645: Add retry loop to npm install command
1 parent 362088e commit 40198ac

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

codeserver/ubi9-python-3.12/get_code_server_rpm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ||"$ARCH" == "ppc64le" ]]; then
6565
source ${NVM_DIR}/nvm.sh
6666
while IFS= read -r src_patch; do echo "patches/$src_patch"; patch -p1 < "patches/$src_patch"; done < patches/series
6767
nvm use ${NODE_VERSION}
68-
npm install
68+
../utils/install_with_retry.sh npm-install
6969
npm run build
7070
VERSION=${CODESERVER_VERSION/v/} npm run build:vscode
7171
npm run release

codeserver/ubi9-python-3.12/utils/install_with_retry.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22

3-
# Shared install script with retry logic for dnf and texlive (install_pdf_deps).
3+
# Shared install script with retry logic for dnf, texlive (install_pdf_deps), and npm.
44
# Usage:
55
# ./install_with_retry.sh dnf-install <package> [package ...]
66
# ./install_with_retry.sh texlive-install
7+
# ./install_with_retry.sh npm-install
78

89
set -Eeuxo pipefail
910

@@ -49,6 +50,10 @@ texlive_install() {
4950
CLEANUP_CMD= run_with_retry "$script_dir/install_pdf_deps.sh"
5051
}
5152

53+
npm_install() {
54+
CLEANUP_CMD="rm -rf node_modules" run_with_retry npm install
55+
}
56+
5257
main() {
5358
case "${1:-}" in
5459
dnf-install)
@@ -58,10 +63,14 @@ main() {
5863
texlive-install)
5964
texlive_install
6065
;;
66+
npm-install)
67+
npm_install
68+
;;
6169
*)
62-
echo "Usage: $0 {dnf-install|texlive-install} [args...]" >&2
70+
echo "Usage: $0 {dnf-install|texlive-install|npm-install} [args...]" >&2
6371
echo " dnf-install <package> [package ...] Install RPM packages with retry" >&2
6472
echo " texlive-install Run install_pdf_deps.sh with retry" >&2
73+
echo " npm-install Run npm install with retry" >&2
6574
exit 1
6675
;;
6776
esac

jupyter/utils/install_with_retry.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22

3-
# Shared install script with retry logic for dnf and texlive (install_pdf_deps).
3+
# Shared install script with retry logic for dnf, texlive (install_pdf_deps), and npm.
44
# Usage:
55
# ./install_with_retry.sh dnf-install <package> [package ...]
66
# ./install_with_retry.sh texlive-install
7+
# ./install_with_retry.sh npm-install
78

89
set -Eeuxo pipefail
910

@@ -49,6 +50,10 @@ texlive_install() {
4950
CLEANUP_CMD= run_with_retry "$script_dir/install_pdf_deps.sh"
5051
}
5152

53+
npm_install() {
54+
CLEANUP_CMD="rm -rf node_modules" run_with_retry npm install
55+
}
56+
5257
main() {
5358
case "${1:-}" in
5459
dnf-install)
@@ -58,10 +63,14 @@ main() {
5863
texlive-install)
5964
texlive_install
6065
;;
66+
npm-install)
67+
npm_install
68+
;;
6169
*)
62-
echo "Usage: $0 {dnf-install|texlive-install} [args...]" >&2
70+
echo "Usage: $0 {dnf-install|texlive-install|npm-install} [args...]" >&2
6371
echo " dnf-install <package> [package ...] Install RPM packages with retry" >&2
6472
echo " texlive-install Run install_pdf_deps.sh with retry" >&2
73+
echo " npm-install Run npm install with retry" >&2
6574
exit 1
6675
;;
6776
esac

0 commit comments

Comments
 (0)