diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b229b4dc87dac9651e985f3d83972a91d4d95871..8a42f377b501338a9ff34ab3cf7f3547cf81ecd0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,12 +2,12 @@ stages: - verify - build - test - - test:npm_install - - test:dependency_checker - - test:sonar-scanner - publish - security +include: + - local: .gitlab/ci/test.dependency_check.yml + .Check Makefile: stage: verify tags: @@ -38,67 +38,6 @@ stages: - 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 -Test Dependency Checker npm install: - stage: test:npm_install - tags: - - docker - image: node:alpine - cache: - paths: - - t/dependency-check/simple-app/node_modules/ - script: - - cd t/dependency-check/simple-app/ - - npm install - -Test Dependency Checker sonar-scanner: - stage: test:sonar-scanner - image: - name: its-registry.unl.edu/unl-its/docker-ci/static-code-analysis - cache: - policy: pull - paths: - - t/dependency-check/simple-app/dependency_check_results/ - variables: - DEPENDENCY_CHECK_OUT_DIR: t/dependency-check/simple-app/dependency_check_results/ - SRC_DIR: t/dependency-check/simple-app/ - tags: - - docker - script: - - sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.sources=$SRC_DIR -Dsonar.login=$SONAR_TOKEN -Dsonar.dependencyCheck.reportPath=${DEPENDENCY_CHECK_OUT_DIR}/dependency-check-report.xml -Dsonar.dependencyCheck.htmlReportPath=${DEPENDENCY_CHECK_OUT_DIR}/dependency-check-report.html -Dsonar.scm.disabled=True - -Test Dependency Checker dependency_check: - stage: test:dependency_checker - image: - name: its-registry.unl.edu/unl-its/docker-ci/dependency-check - cache: - policy: pull - paths: - - t/dependency-check/simple-app/dependency_check_results/ - variables: - DEPENDENCY_CHECK_OUT_DIR: t/dependency-check/simple-app/dependency_check_results/ - SRC_DIR: t/dependency-check/simple-app/ - tags: - - docker - script: - - dependency-check --format ALL -s ${SRC_DIR} --out ${DEPENDENCY_CHECK_OUT_DIR} --project ${CI_PROJECT_NAMESPACE} -n - artifacts: - paths: - - t/dependency-check/simple-app/dependency_check_results/dependency-check-report.html - - t/dependency-check/simple-app/dependency_check_results/dependency-check-report.xml - expire_in: 1 day - - -.Test Dependency Checker: - stage: test - tags: - - dockerd - script: - - ls -al - - docker run --rm -v "${PWD}/t/dependency-check/simple-app:/work" -w /work --entrypoint "/bin/ls -al" node:alpine npm install - - 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 -e DEPENDENCY_CHECK_OUT_DIR=./ its-registry.unl.edu/unl-its/docker-ci/dependency-check - - docker run --rm -v "${PWD}:/work" -w /work 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 -Dsonar.dependencyCheck.reportPath=dependency-check-report.xml -Dsonar.dependencyCheck.htmlReportPath=dependency-check-report.html - .Test PHP Lint: stage: test tags: diff --git a/.gitlab/ci/test.dependency_check.yml b/.gitlab/ci/test.dependency_check.yml index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0f96840928d0d45e3e6728a4fc682d220d8c9858 100644 --- a/.gitlab/ci/test.dependency_check.yml +++ b/.gitlab/ci/test.dependency_check.yml @@ -0,0 +1,51 @@ +test:dependency_checker:npm_install: + stage: test + tags: + - docker + image: node:alpine + cache: + paths: + - t/dependency-check/simple-app/node_modules/ + script: + - cd t/dependency-check/simple-app/ + - npm install + +test:dependency_checker:sonar-scanner: + stage: test + needs: ["test:dependency_checker:npm_install"] + image: + name: its-registry.unl.edu/unl-its/docker-ci/static-code-analysis + cache: + policy: pull + paths: + - t/dependency-check/simple-app/dependency_check_results/ + variables: + DEPENDENCY_CHECK_OUT_DIR: t/dependency-check/simple-app/dependency_check_results/ + SRC_DIR: t/dependency-check/simple-app/ + tags: + - docker + script: + - sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.sources=$SRC_DIR -Dsonar.login=$SONAR_TOKEN -Dsonar.dependencyCheck.reportPath=${DEPENDENCY_CHECK_OUT_DIR}/dependency-check-report.xml -Dsonar.dependencyCheck.htmlReportPath=${DEPENDENCY_CHECK_OUT_DIR}/dependency-check-report.html -Dsonar.scm.disabled=True + +test:dependency_checker:dependency_check: + stage: test + needs: ["test:dependency_checker:sonar-scanner"] + image: + name: its-registry.unl.edu/unl-its/docker-ci/dependency-check + cache: + policy: pull + paths: + - t/dependency-check/simple-app/dependency_check_results/ + variables: + DEPENDENCY_CHECK_OUT_DIR: t/dependency-check/simple-app/dependency_check_results/ + SRC_DIR: t/dependency-check/simple-app/ + tags: + - docker + script: + - dependency-check --format ALL -s ${SRC_DIR} --out ${DEPENDENCY_CHECK_OUT_DIR} --project ${CI_PROJECT_NAMESPACE} -n + artifacts: + paths: + - t/dependency-check/simple-app/dependency_check_results/dependency-check-report.html + - t/dependency-check/simple-app/dependency_check_results/dependency-check-report.xml + expire_in: 1 day +