]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Check for missing npm resolutions
authorTiago Melo <tmelo@suse.com>
Mon, 23 Mar 2020 19:54:06 +0000 (18:54 -0100)
committerTiago Melo <tmelo@suse.com>
Tue, 24 Mar 2020 21:10:04 +0000 (20:10 -0100)
Check if it's necessary to run "npm run fix:audit" before committing the changes.

This is important to resolve some issues with building and
to fix some npm vulnerabilities.

Fixes: https://tracker.ceph.com/issues/44723
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/run-frontend-unittests.sh

index afb8dd9ae9cac5cbc26bdc127ad05f75510f32be..38c47f8e4d779228bdbfb3618b16200f59674baf 100755 (executable)
@@ -38,13 +38,21 @@ fi
 # I18N
 npm run i18n:extract
 i18n_lint=`awk '/<source> |<source>$| <\/source>/,/<\/context-group>/ {printf "%-4s ", NR; print}' src/locale/messages.xlf`
-if [[ ! -z $i18n_lint ]]; then
+if [ "$i18n_lint" ]; then
   echo -e "The following source translations in 'messages.xlf' need to be \
 fixed, please check the I18N suggestions in 'HACKING.rst':\n"
   echo "${i18n_lint}"
   failed=true
 fi
 
+# npm resolutions
+npm run fix:audit
+resolutions=`git status | grep package-lock.json`
+if [ "$resolutions" ]; then
+  echo "Please run 'npm run fix:audit' before committing."
+  failed=true
+fi
+
 if [ `uname` != "FreeBSD" ]; then
   deactivate
 fi