diff options
| -rw-r--r-- | .gitlab-ci.yml | 27 | ||||
| -rwxr-xr-x | run.sh | 6 | ||||
| -rw-r--r-- | test/results/python-pip.json | 195 | ||||
| -rwxr-xr-x | test/test.sh | 35 |
4 files changed, 239 insertions, 24 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1190750..7a908c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,14 +60,37 @@ container_scanning: reports: container_scanning: gl-container-scanning-report.json -QA: +.QA: image: docker:stable stage: test script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - docker pull $TMP_IMAGE - - docker run $TMP_IMAGE test + - mkdir results + - docker run --volume `pwd`/results:/results $TMP_IMAGE test $QA_PROJECT $QA_REF + artifacts: + paths: + - results/ + when: always + +QA:java-maven: + extends: .QA + variables: + QA_PROJECT: java-maven + QA_REF: ccec8318 + +QA:python-pip: + extends: .QA + variables: + QA_PROJECT: python-pip + QA_REF: 04dce91b + +QA:ruby-bundler: + extends: .QA + variables: + QA_PROJECT: ruby-bundler + QA_REF: 6b858821 .docker_tag: image: docker:stable @@ -7,7 +7,7 @@ $(basename "$0") [-h] $(basename "$0") analyze PROJECT_PATH -$(basename "$0") test +$(basename "$0") test PROJECT_NAME PROJECT_REF where: -h show this help text @@ -60,7 +60,7 @@ if [ "$COMMAND" = "analyze" -a $# -ne 1 ] ; then exit 1 fi -if [ "$COMMAND" = "test" -a $# -ne 0 ] ; then +if [ "$COMMAND" = "test" -a $# -ne 2 ] ; then echo "$usage" exit 1 fi @@ -69,7 +69,7 @@ fi case "$COMMAND" in test) # Run integration tests. - exec /test/test.sh + exec /test/test.sh $1 $2 ;; analyze) diff --git a/test/results/python-pip.json b/test/results/python-pip.json new file mode 100644 index 0000000..b5e724a --- /dev/null +++ b/test/results/python-pip.json @@ -0,0 +1,195 @@ +{ + "licenses": [ + { + "count": 4, + "name": "BSD" + }, + { + "count": 4, + "name": "MIT" + }, + { + "count": 1, + "name": "Copyright (c) 2015, Julien Fache" + }, + { + "count": 1, + "name": "New BSD License" + }, + { + "count": 1, + "name": "Python Software Foundation License" + }, + { + "count": 1, + "name": "Standard PIL License" + } + ], + "dependencies": [ + { + "license": { + "name": "BSD", + "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" + }, + "dependency": { + "name": "Django", + "url": "https://www.djangoproject.com/", + "description": "A high-level Python Web framework that encourages rapid development and clean, pragmatic design.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Standard PIL License" + }, + "dependency": { + "name": "Pillow", + "url": "https://python-pillow.org", + "description": "Python Imaging Library (Fork)", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "beautifulsoup4", + "url": "http://www.crummy.com/software/BeautifulSoup/bs4/", + "description": "Screen-scraping library", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "BSD", + "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" + }, + "dependency": { + "name": "django-contrib-comments", + "url": "https://github.com/django/django-contrib-comments", + "description": "The code formerly known as django.contrib.comments.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "BSD", + "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" + }, + "dependency": { + "name": "django-js-asset", + "url": "https://github.com/matthiask/django-js-asset/", + "description": "script tag with additional attributes for django.forms.Media", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "django-mptt", + "url": "http://github.com/django-mptt/django-mptt", + "description": "Utilities for implementing Modified Preorder Tree Traversal with your Django Models and working with trees of Model instances.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "BSD", + "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" + }, + "dependency": { + "name": "django-tagging", + "url": "https://github.com/Fantomas42/django-tagging", + "description": "Generic tagging application for Django", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "New BSD License" + }, + "dependency": { + "name": "django-xmlrpc", + "url": "https://github.com/Fantomas42/django-xmlrpc", + "description": "XML-RPC Server App for the Django framework.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Copyright (c) 2015, Julien Fache" + }, + "dependency": { + "name": "mots-vides", + "url": "https://github.com/Fantomas42/mots-vides", + "description": "Python library for managing stop words in many languages.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "pyparsing", + "url": "http://pyparsing.wikispaces.com/", + "description": "Python parsing module", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "pytz", + "url": "http://pythonhosted.org/pytz", + "description": "World timezone definitions, modern and historical", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Python Software Foundation License", + "url": "http://hg.python.org/cpython/raw-file/89ce323357db/LICENSE" + }, + "dependency": { + "name": "regex", + "url": "https://bitbucket.org/mrabarnett/mrab-regex", + "description": "Alternative regular expression module, to replace re.", + "pathes": [ + "." + ] + } + } + ] +} diff --git a/test/test.sh b/test/test.sh index 53c1805..40c29f0 100755 --- a/test/test.sh +++ b/test/test.sh @@ -2,26 +2,23 @@ set -e -for project in ruby-bundler-rails java-maven; do - # Clone the test repository. - echo "Cloning the test repository https://gitlab.com/gitlab-org/security-products/tests/$project.git" - git clone "https://gitlab.com/gitlab-org/security-products/tests/$project.git" "/code/$project" +project=$1 +ref=$2 +url="https://gitlab.com/gitlab-org/security-products/tests/$project.git" - # Run license management on it. - echo "Running license management on the $project" - cd "/code/$project" - /run.sh analyze . +# Clone the test repository. +echo "Cloning the test project $project from $url" +git clone "$url" "/code/$project" - # Compare results with expected results. - set +e - diff "/code/$project/gl-license-management-report.json" "/test/results/$project.json" > /diff.txt - set -e +# Run license management on it. +echo "Running license management on the $project with ref $ref" +cd "/code/$project" +git checkout "$ref" 2> /dev/null +/run.sh analyze . - if [ -s /diff.txt ] ; then - echo "Unexpected result. Here is the diff between actual results and those expected :" - cat /diff.txt - exit 1 - fi -done +# In order to upload the artifact to check it manually +mkdir -p /results/ +cp "/code/$project/gl-license-management-report.json" "/results/$project-gl-license-management-report.json" -echo "All tests are OK." +# Compare results with expected results. +diff -u "/code/$project/gl-license-management-report.json" "/test/results/$project.json" |
