Commit 77236235 authored by SBassett's avatar SBassett
Browse files

Tabs to spaces, ugh

parent 858a5865
Pipeline #1414 passed with stage
in 47 seconds
......@@ -11,41 +11,41 @@ auditjs_dependency_check:
- apt-get update -yqq && apt-get install -yqq git
- npm install -g auditjs
- |
# check if alternative npm audit options were specified calling gitlab-ci.yml file
if [ ! -z ${WM_APPSEC_AUDITJS_OPTIONS} ]; then
AUDITJS_OPTIONS=${WM_APPSEC_AUDITJS_OPTIONS}
fi
# check if alternative npm audit options were specified calling gitlab-ci.yml file
if [ ! -z ${WM_APPSEC_AUDITJS_OPTIONS} ]; then
AUDITJS_OPTIONS=${WM_APPSEC_AUDITJS_OPTIONS}
fi
# create a new package lock file, run auditjs
script:
- |
root_dir=$(pwd)
file_list=$(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA -- \
{*package.json,*package-lock.json,*/package.json,*/package-lock.json})
root_dir=$(pwd)
file_list=$(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA -- \
{*package.json,*package-lock.json,*/package.json,*/package-lock.json})
# find all modified package.json files and run audit-ci against them
TOTAL_EXIT_CODES=0
for f in $file_list; do
npm_dir="$(dirname "$f")"
cd $root_dir/$npm_dir
npm install --package-lock-only
echo -e "\n "
echo -e "----- $f -----"
echo -e "\n "
set -e
EXIT_CODE=0
auditjs ${AUDITJS_OPTIONS} || EXIT_CODE=$?
TOTAL_EXIT_CODES=$(($TOTAL_EXIT_CODES + $EXIT_CODE))
done
# find all modified package.json files and run audit-ci against them
TOTAL_EXIT_CODES=0
for f in $file_list; do
npm_dir="$(dirname "$f")"
cd $root_dir/$npm_dir
npm install --package-lock-only
echo -e "\n "
echo -e "----- $f -----"
echo -e "\n "
set -e
EXIT_CODE=0
auditjs ${AUDITJS_OPTIONS} || EXIT_CODE=$?
TOTAL_EXIT_CODES=$(($TOTAL_EXIT_CODES + $EXIT_CODE))
done
if [ "$TOTAL_EXIT_CODES" -gt 0 ]; then
echo -e "\n "
echo -e "At least one package.json file contained vulnerable dependencies, please review."
echo -e "\n "
exit 1
fi
if [ "$TOTAL_EXIT_CODES" -gt 0 ]; then
echo -e "\n "
echo -e "At least one package.json file contained vulnerable dependencies, please review."
echo -e "\n "
exit 1
fi
# only run on changes to package and package.lock .json
# only run on changes to package and package.lock .json
only:
changes:
- package.json
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment