Skip to content
Snippets Groups Projects
Commit 209028b5 authored by Jose Raul Barreras's avatar Jose Raul Barreras
Browse files

integrate dependency-check with Sonarqube

parent 1100cbfb
No related branches found
No related tags found
1 merge request!33Resolve "Integrate dependency-check container with Sonarqube"
...@@ -34,7 +34,21 @@ Test Sonar Scanner: ...@@ -34,7 +34,21 @@ Test Sonar Scanner:
script: script:
- docker run --rm its-registry.unl.edu/unl-its/docker-ci/static-code-analysis sonar-scanner -v - docker run --rm its-registry.unl.edu/unl-its/docker-ci/static-code-analysis sonar-scanner -v
- docker run --rm -v "${PWD}:/work" -w /work its-registry.unl.edu/unl-its/docker-ci/detect-secrets -s - docker run --rm -v "${PWD}:/work" -w /work its-registry.unl.edu/unl-its/docker-ci/detect-secrets -s
- docker run --rm -v "${PWD}:/work" -w /work its-registry.unl.edu/unl-its/docker-ci/dependency-check -v
.Test Dependency Checker:
stage: test
tags:
- dockerd
script:
- docker run --rm -v "${PWD}/t/dependency-check/simple-app:/work" -w /work node:alpine npm install
- docker run --rm -v "${PWD}/t/dependency-check/simple-app:/work" -w /work its-registry.unl.edu/unl-its/docker-ci/dependency-check
- docker run --rm its-registry.unl.edu/unl-its/docker-ci/static-code-analysis sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.sources=. -Dsonar.login=$SONAR_TOKEN
artifacts:
paths:
- dependency-check-report.xml
- dependency-check-report.html
expire_in: 1 day
Test PHP Lint: Test PHP Lint:
stage: test stage: test
......
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
To build these images, clone this repository onto a machine with docker and make installed. Run `make` and all of the images will be built and installed as local docker images. To build these images, clone this repository onto a machine with docker and make installed. Run `make` and all of the images will be built and installed as local docker images.
This file is automatically updated after execute `git commit` based on the content of file `_README.md` To enable this feature, execute `.dev/bootstrap.sh` after cloning the repo. This file is automatically updated after execute `git commit` based on the content of file `_README.md` To enable this feature, execute `.dev/bootstrap.sh` after cloning the repo.
### Available tools ### Available tools \n\n- its-registry.unl.edu/unl-its/docker-ci/android-build-server:latest
- its-registry.unl.edu/unl-its/docker-ci/android-build-server:latest
- its-registry.unl.edu/unl-its/docker-ci/dependency-check - its-registry.unl.edu/unl-its/docker-ci/dependency-check
- its-registry.unl.edu/unl-its/docker-ci/detect-secrets - its-registry.unl.edu/unl-its/docker-ci/detect-secrets
- its-registry.unl.edu/unl-its/docker-ci/magento2-unit-test:latest - its-registry.unl.edu/unl-its/docker-ci/magento2-unit-test:latest
...@@ -27,7 +25,4 @@ This file is automatically updated after execute `git commit` based on the conte ...@@ -27,7 +25,4 @@ This file is automatically updated after execute `git commit` based on the conte
- its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:android - its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:android
- its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:latest - its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:latest
- its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:php - its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:php
- its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:python - its-registry.unl.edu/unl-its/docker-ci/static-code-analysis:python \n \n\n\r_Last update: Wed Sep 18 15:39:40 CDT 2019_\n
_Last update: Fri May 31 17:38:34 CDT 2019_
...@@ -6,9 +6,13 @@ if [ $1 == '-v' ]; then ...@@ -6,9 +6,13 @@ if [ $1 == '-v' ]; then
exit 0 exit 0
fi fi
dependency-check.sh -n --project ${CI_PROJECT_NAMESPACE} -s ./ -f JSON DEPENDENCY_CHECK_OUT_DIR=${DEPENDENCY_CHECK_OUT_DIR-"`pwd`/dependency-check-report/"}
cat dependency-check-report.json | jq '.dependencies | .[] | select (.vulnerabilities) | [.fileName, .filePath, .vulnerabilities]' | sed -e "s/\"\/work\///g"
RESULT=`cat dependency-check-report.json | jq '.dependencies | .[] | select (.vulnerabilities) | [.fileName, .filePath, .vulnerabilities] | length == 0' | sed -e "s/\"\/work\///g"` mkdir -p ${DEPENDENCY_CHECK_OUT_DIR}
dependency-check.sh --format ALL -s ./ --out ${DEPENDENCY_CHECK_OUT_DIR} --project ${CI_PROJECT_NAMESPACE} -n
cat ${DEPENDENCY_CHECK_OUT_DIR}/dependency-check-report.json | jq '.dependencies | .[] | select (.vulnerabilities) | [.fileName, .filePath, .vulnerabilities]' | sed -e "s/\"\/work\///g"
RESULT=`cat ${DEPENDENCY_CHECK_OUT_DIR}/dependency-check-report.json | jq '.dependencies | .[] | select (.vulnerabilities) | [.fileName, .filePath, .vulnerabilities] | length == 0' | sed -e "s/\"\/work\///g"`
if [ "${RESULT}" = "" ]; then if [ "${RESULT}" = "" ]; then
exit 0 exit 0
......
{
"name": "dependency-check-demo-app",
"version": "1.0.0",
"description": "Simple app with old dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"braces": "2.3.0",
"lodash": "4.17.10",
"open": "0.0.5",
"jquery": "2.3.0",
"tar": "4.5.0"
},
"author": "Raul Barreras",
"license": "ISC"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment