From d57e616015f96681f8c3cf2ce36bdd85a24e2163 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 15 Aug 2019 10:54:48 -0600 Subject: insert shim to generate report via ruby API --- .dockerignore | 1 + .gitignore | 1 + .gitlab-ci.yml | 6 +- CHANGELOG.md | 5 + Dockerfile | 4 + README.md | 2 +- bin/test | 17 ++ bin/test_all | 21 ++ exe/license_management | 6 + lib/license/management.rb | 20 ++ lib/license/management/json_report.rb | 28 ++ lib/license/management/loggable.rb | 15 + lib/license/management/repository.rb | 46 +++ lib/license/management/verifiable.rb | 15 + lib/license/management/version.rb | 7 + lib/license/management/versions/base.rb | 34 +++ lib/license/management/versions/v1.rb | 72 +++++ license-management.gemspec | 31 ++ licenses.yml | 82 ++++++ run.sh | 18 +- test/results/go-modules-v1.json | 22 ++ test/results/go-modules.json | 22 -- test/results/java-maven-v1.json | 505 ++++++++++++++++++++++++++++++++ test/results/java-maven.json | 505 -------------------------------- test/results/python-pip-v1.json | 195 ++++++++++++ test/results/python-pip.json | 195 ------------ test/results/python3-pip-v1.json | 212 ++++++++++++++ test/results/python3-pip.json | 212 -------------- test/results/ruby-bundler-v1.json | 242 +++++++++++++++ test/results/ruby-bundler.json | 242 --------------- 30 files changed, 1599 insertions(+), 1184 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100755 bin/test create mode 100755 bin/test_all create mode 100755 exe/license_management create mode 100644 lib/license/management.rb create mode 100644 lib/license/management/json_report.rb create mode 100644 lib/license/management/loggable.rb create mode 100644 lib/license/management/repository.rb create mode 100644 lib/license/management/verifiable.rb create mode 100644 lib/license/management/version.rb create mode 100644 lib/license/management/versions/base.rb create mode 100644 lib/license/management/versions/v1.rb create mode 100644 license-management.gemspec create mode 100644 licenses.yml create mode 100644 test/results/go-modules-v1.json delete mode 100644 test/results/go-modules.json create mode 100644 test/results/java-maven-v1.json delete mode 100644 test/results/java-maven.json create mode 100644 test/results/python-pip-v1.json delete mode 100644 test/results/python-pip.json create mode 100644 test/results/python3-pip-v1.json delete mode 100644 test/results/python3-pip.json create mode 100644 test/results/ruby-bundler-v1.json delete mode 100644 test/results/ruby-bundler.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6b8710a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9a5aec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d54da14..464757f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,13 +35,15 @@ container_scanning: image: docker:stable stage: test variables: + FEATURE_RUBY_REPORT: 'false' LM_PYTHON_VERSION: 2 + LM_REPORT_VERSION: 1 script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - docker pull $TMP_IMAGE - mkdir results - - docker run --env LM_PYTHON_VERSION --volume `pwd`/results:/results $TMP_IMAGE test $QA_PROJECT ${QA_RESULTS:-$QA_PROJECT} $QA_REF + - ./bin/test artifacts: paths: - results/ @@ -63,7 +65,7 @@ QA:python3-pip: extends: .QA variables: LM_PYTHON_VERSION: 3 - QA_RESULTS: python3-pip + QA_RESULTS: python3-pip-v1 QA_PROJECT: python-pip QA_REF: 48e250a1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 57c9bd2..73eac53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # GitLab License management changelog +## v1.6.0 + +- Convert HTML to JSON transformation to generating a JSON report directly. + + ## v1.5.0 - Reverts 1.4.0 diff --git a/Dockerfile b/Dockerfile index 900019b..447c3a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,9 @@ RUN apt-get update && \ libpq-dev libmysqlclient-dev realpath python3-dev python3-pip && \ rm -rf /var/lib/apt/lists/* +COPY . /opt/license-management/ +RUN bash -lc "cd /opt/license-management && gem build *.gemspec && gem install *.gem" + # Don't load RVM automatically, it doesn't work with GitLab-CI RUN mv /etc/profile.d/rvm.sh /rvm.sh @@ -43,6 +46,7 @@ RUN pip3 install --disable-pip-version-check setuptools==$SETUPTOOLS_VERSION && # Version of Python, defaults to Python 2.7 ARG LM_PYTHON_VERSION ENV LM_PYTHON_VERSION ${LM_PYTHON_VERSION:-2.7} +ENV LM_REPORT_VERSION ${LM_REPORT_VERSION:-1} COPY test /test COPY run.sh html2json.js / diff --git a/README.md b/README.md index 62daeaa..e23b216 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ docker run --rm --volume "/path/to/my/project":/code license-management analyze You can run integration tests on the image like this: ```sh -docker run --rm license-management /test/test.sh project_name git_ref +./bin/test_all ``` where: diff --git a/bin/test b/bin/test new file mode 100755 index 0000000..c1cd989 --- /dev/null +++ b/bin/test @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +export FEATURE_RUBY_REPORT=${FEATURE_RUBY_REPORT:-true} +export LM_PYTHON_VERSION=${LM_PYTHON_VERSION:-2} +export LM_REPORT_VERSION=${LM_REPORT_VERSION:-1} +export QA_RESULTS=${QA_RESULTS:-$QA_PROJECT-v$LM_REPORT_VERSION} +export RESULTS_DIR=${RESULTS_DIR:-`pwd`/results} + +docker run \ + --rm \ + --env FEATURE_RUBY_REPORT \ + --env LM_PYTHON_VERSION \ + --env LM_REPORT_VERSION \ + --volume $RESULTS_DIR:/results \ + $TMP_IMAGE test $QA_PROJECT ${QA_RESULTS} $QA_REF diff --git a/bin/test_all b/bin/test_all new file mode 100755 index 0000000..1aa19b4 --- /dev/null +++ b/bin/test_all @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +export RESULTS_DIR=`pwd`/tmp +export TMP_IMAGE=$(basename $PWD):latest + +docker pull licensefinder/license_finder:5.6.2 +docker build . -t $TMP_IMAGE + +REPORT_VERSIONS=(1) +for version in "${REPORT_VERSIONS[@]}" +do + export LM_REPORT_VERSION=$version + echo "Report Version $LM_REPORT_VERSION" + QA_PROJECT=go-modules QA_RESULTS="go-modules-v$version" QA_REF=master ./bin/test + QA_PROJECT=java-maven QA_RESULTS="java-maven-v$version" QA_REF=831c7a04 ./bin/test + QA_PROJECT=python-pip QA_RESULTS="python-pip-v$version" QA_REF=04dce91b LM_PYTHON_VERSION=2 ./bin/test + QA_PROJECT=python-pip QA_RESULTS="python3-pip-v$version" QA_REF=48e250a1 LM_PYTHON_VERSION=3 ./bin/test + QA_PROJECT=ruby-bundler QA_RESULTS="ruby-bundler-v$version" QA_REF=6b858821 ./bin/test +done diff --git a/exe/license_management b/exe/license_management new file mode 100755 index 0000000..33e110e --- /dev/null +++ b/exe/license_management @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'license/management' + +LicenseFinder::CLI::Main.start(ARGV) diff --git a/lib/license/management.rb b/lib/license/management.rb new file mode 100644 index 0000000..3b41843 --- /dev/null +++ b/lib/license/management.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'pathname' +require 'yaml' +require 'license_finder' +require 'license/management/loggable' +require 'license/management/verifiable' +require 'license/management/repository' +require 'license/management/versions/base' +require 'license/management/versions/v1' +require 'license/management/json_report' +require 'license/management/version' + +module License + module Management + def self.root + Pathname.new(File.dirname(__FILE__)).join('../..') + end + end +end diff --git a/lib/license/management/json_report.rb b/lib/license/management/json_report.rb new file mode 100644 index 0000000..19a44c4 --- /dev/null +++ b/lib/license/management/json_report.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This is a monkey patch of the JsonReport found in `license_finder` +module LicenseFinder + class JsonReport < CsvReport + DEFAULT_VERSION = '1' + VERSIONS = { + nil => ::License::Management::Versions::V1, + '' => ::License::Management::Versions::V1, + '1' => ::License::Management::Versions::V1, + '1.0' => ::License::Management::Versions::V1 + }.freeze + + def to_s + JSON.pretty_generate(version_for(report_version).to_h) + "\n" + end + + private + + def report_version + ENV.fetch('LM_REPORT_VERSION', DEFAULT_VERSION) + end + + def version_for(version) + VERSIONS.fetch(version.to_s).new(dependencies) + end + end +end diff --git a/lib/license/management/loggable.rb b/lib/license/management/loggable.rb new file mode 100644 index 0000000..a44d45d --- /dev/null +++ b/lib/license/management/loggable.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module License + module Management + module Loggable + def logger + ::LicenseFinder::Core.default_logger + end + + def log_info(message) + logger.info(self.class, message) + end + end + end +end diff --git a/lib/license/management/repository.rb b/lib/license/management/repository.rb new file mode 100644 index 0000000..707d9f0 --- /dev/null +++ b/lib/license/management/repository.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module License + module Management + class Repository + include Loggable + include Verifiable + + def initialize( + compatibility_path: License::Management.root.join('licenses.yml') + ) + @compatibility_data = YAML.safe_load(IO.read(compatibility_path)) + end + + def item_for(license) + id = id_for(license) + item = id ? compatibility_data['items'][id] : nil + item ? { 'id' => id }.merge(item) : generate_item_for(license) + end + + private + + attr_reader :compatibility_data + + def id_for(license) + ids = compatibility_data['ids'] + ids[license.send(:short_name)] || ids[license.url] + end + + def take_first_line_from(content) + return '' if blank?(content) + + content.split(/[\r\n]+/)[0] + end + + def generate_item_for(license) + log_info("detected unknown license named `#{license.send(:short_name)}`") + { + 'id' => 'unknown', + 'name' => take_first_line_from(license.name), + 'url' => present?(license.url) ? license.url : '' + } + end + end + end +end diff --git a/lib/license/management/verifiable.rb b/lib/license/management/verifiable.rb new file mode 100644 index 0000000..72667fb --- /dev/null +++ b/lib/license/management/verifiable.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module License + module Management + module Verifiable + def blank?(item) + item.nil? || item.empty? + end + + def present?(item) + !blank?(item) + end + end + end +end diff --git a/lib/license/management/version.rb b/lib/license/management/version.rb new file mode 100644 index 0000000..d679b3f --- /dev/null +++ b/lib/license/management/version.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module License + module Management + VERSION = '1.6.0' + end +end diff --git a/lib/license/management/versions/base.rb b/lib/license/management/versions/base.rb new file mode 100644 index 0000000..6e30e20 --- /dev/null +++ b/lib/license/management/versions/base.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module License + module Management + module Versions + class Base + include Loggable + include Verifiable + + attr_reader :dependencies, :repository + + def initialize(dependencies) + @dependencies = dependencies + @repository = License::Management::Repository.new + end + + private + + def paths_from(dependency) + return [] unless dependency.respond_to?(:aggregate_paths) + + paths = dependency.aggregate_paths + return [] if blank?(paths) + + paths.map { |x| x.gsub(Dir.pwd, '.') } + end + + def description_for(dependency) + present?(dependency.summary) ? dependency.summary : dependency.description + end + end + end + end +end diff --git a/lib/license/management/versions/v1.rb b/lib/license/management/versions/v1.rb new file mode 100644 index 0000000..d448397 --- /dev/null +++ b/lib/license/management/versions/v1.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +module License + module Management + module Versions + class V1 < Base + def to_h + { + licenses: license_summary, + dependencies: formatted_dependencies(dependencies) + } + end + + private + + # when a dependency has multiple licenses, this will join the licenses into a single name + # this defect was backported from the htmltojson version of this script. + def license_summary + dependencies + .map { |x| x.licenses.map { |y| best_name_for(y) }.sort.reverse.join(', ') } + .flatten + .group_by { |name| name } + .map { |(license, items)| { count: items.count, name: license } } + .sort_by { |x| [-x[:count], x[:name]] } + end + + # when a dependency has more than one license + # this method chooses one of the urls. + # to maintain backwards compatibility this bug has been carried forward. + def license_for(dependency) + name = join_license_names(dependency.licenses) + urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort + log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 + url = urls[0] || data_for(dependency.licenses.first)['url'] + blank?(url) ? { name: name } : { name: name, url: url } + end + + def join_license_names(licenses) + licenses.map { |x| best_name_for(x) }.join(', ') + end + + def map_from_dependency(dependency) + result = { + license: license_for(dependency), + dependency: { + name: dependency.name, + url: dependency.homepage, + description: description_for(dependency), + pathes: paths_from(dependency) + } + } + result[:dependency].delete(:url) if blank?(dependency.homepage) + result + end + + def formatted_dependencies(dependencies) + dependencies + .sort_by(&:name) + .map { |x| map_from_dependency(x) } + end + + def best_name_for(license) + data_for(license)['name'] + end + + def data_for(license) + repository.item_for(license) + end + end + end + end +end diff --git a/license-management.gemspec b/license-management.gemspec new file mode 100644 index 0000000..99cb1b1 --- /dev/null +++ b/license-management.gemspec @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'license/management/version' + +Gem::Specification.new do |spec| + spec.name = 'license-management' + spec.version = License::Management::VERSION + spec.authors = ['Fabien Catteau', 'Olivier Gonzalez'] + spec.email = ['fcatteau@gitlab.com', 'ogonzalez@gitlab.com'] + + spec.summary = 'License Management job for GitLab CI.' + spec.description = 'License Management job for GitLab CI.' + spec.homepage = 'https://gitlab.com/gitlab-org/security-products/license-management' + spec.license = 'GitLab EE' + + spec.metadata['allowed_push_host'] = 'https://example.com' + spec.metadata['homepage_uri'] = spec.homepage + spec.metadata['source_code_uri'] = 'https://gitlab.com/gitlab-org/security-products/license-management' + spec.metadata['changelog_uri'] = 'https://gitlab.com/gitlab-org/security-products/license-management/blob/master/CHANGELOG.md' + + spec.files = Dir.chdir(File.expand_path(__dir__)) do + Dir.glob('exe/*') + Dir.glob('lib/**/**/*.{rb,yml}') + Dir.glob('*.{md,yml,json}') + end + spec.bindir = 'exe' + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.require_paths = ['lib'] + + spec.add_dependency 'license_finder', ENV.fetch('LICENSE_FINDER_VERSION', '5.6.2') +end diff --git a/licenses.yml b/licenses.yml new file mode 100644 index 0000000..8ed24b2 --- /dev/null +++ b/licenses.yml @@ -0,0 +1,82 @@ +--- +ids: + ASL, version 2: Apache-2.0 + Apache1_1: Apache-1.1 + Apache2: Apache-2.0 + Apache 2.0: Apache-2.0 + BSD: BSD-4-Clause + CC01: CC0-1.0 + EPL1: EPL-1.0 + GPLv2: GPL-2.0 + GPLv3: GPL-3.0 + ISC: ISC + LGPL 2.1: LGPL-2.1 + LGPL, version 2.1: LGPL-2.1 + LGPL2_1: LGPL-2.1 + LGPL: LGPL-3.0-only + MIT: MIT + MPL 1.1: MPL-1.1 + MPL1_1: MPL-1.1 + MPL2: MPL-2.0 + New BSD License: BSD-3-Clause + NewBSD: BSD-3-Clause + Python: Python-2.0 + Ruby: Ruby + SimplifiedBSD: BSD-2-Clause + http://www.apache.org/licenses/LICENSE-2.0: Apache-2.0 + unknown: unknown +items: + GPL-3.0: + name: GPL 3.0 + url: https://www.gnu.org/licenses/gpl-3.0.txt + BSD-2-Clause: + name: Simplified BSD + url: https://opensource.org/licenses/bsd-license + ISC: + name: ISC + url: https://en.wikipedia.org/wiki/ISC_license + Apache-1.1: + name: Apache 1.1 + url: https://www.apache.org/licenses/LICENSE-1.1.txt + MPL-2.0: + name: Mozilla Public License 2.0 + url: https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt + LGPL-3.0-only: + name: LGPL + url: https://www.gnu.org/licenses/lgpl.txt + CC0-1.0: + name: CC0 1.0 + url: https://creativecommons.org/publicdomain/zero/1.0/ + unknown: + name: unknown + url: '' + GPL-2.0: + name: GPL 2.0 + url: https://www.gnu.org/licenses/gpl-2.0.txt + EPL-1.0: + name: EPL 1.0 + url: https://www.eclipse.org/legal/epl-v10.html + Python-2.0: + name: Python Software Foundation License + url: https://hg.python.org/cpython/raw-file/89ce323357db/LICENSE + BSD-3-Clause: + name: New BSD License + url: https://opensource.org/licenses/BSD-3-Clause + MIT: + name: MIT + url: https://opensource.org/licenses/mit-license + LGPL-2.1: + name: LGPL 2.1 + url: https://opensource.org/licenses/LGPL-2.1 + Ruby: + name: Ruby + url: https://www.ruby-lang.org/en/about/license.txt + Apache-2.0: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.txt + MPL-1.1: + name: MPL 1.1 + url: https://www.mozilla.org/en-US/MPL/1.1/ + BSD-4-Clause: + name: BSD + url: https://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29 diff --git a/run.sh b/run.sh index 0ce0266..1c62414 100755 --- a/run.sh +++ b/run.sh @@ -115,12 +115,13 @@ case "$COMMAND" in gem install bundler # We need to install the license_finder gem into this Ruby version too. gem install license_finder -v "$LICENSE_FINDER_VERSION" + gem install --no-document /opt/license-management/*.gem fi # Ignore test and development dependencies. license_finder ignored_groups add development license_finder ignored_groups add test - bundle install --without "development test" + bundle install --without "development test" --jobs $(nproc) skip_prepare=true fi @@ -189,17 +190,24 @@ case "$COMMAND" in # Run License Finder. echo "Running license_finder $@ in $PWD" - if [ "$skip_prepare" != true ]; then prepare="--prepare" fi - license_finder report ${prepare} --format=html --save=gl-license-management-report.html + if [ "$FEATURE_RUBY_REPORT" = 'true' ]; then + echo "Preparing JSON report..." + license_management report ${prepare} --format=json --save=gl-license-management-report.json + else + echo "Preparing HTML report..." + license_finder report ${prepare} --format=html --save=gl-license-management-report.html + fi # rvm removes trap in bash: https://github.com/rvm/rvm/issues/4416 declare -f restore_lockfile > /dev/null && restore_lockfile popd > /dev/null - # Extract data from the HTML report and put it into a JSON file - node /html2json.js $APP_PATH/gl-license-management-report.html > $APP_PATH/gl-license-management-report.json + if [ -f "gl-license-management-report.html" ]; then + # Extract data from the HTML report and put it into a JSON file + node /html2json.js $APP_PATH/gl-license-management-report.html > $APP_PATH/gl-license-management-report.json + fi ;; *) diff --git a/test/results/go-modules-v1.json b/test/results/go-modules-v1.json new file mode 100644 index 0000000..b946b60 --- /dev/null +++ b/test/results/go-modules-v1.json @@ -0,0 +1,22 @@ +{ + "licenses": [ + { + "count": 1, + "name": "unknown" + } + ], + "dependencies": [ + { + "license": { + "name": "unknown" + }, + "dependency": { + "name": "golang.org/x/crypto", + "description": "", + "pathes": [ + "." + ] + } + } + ] +} diff --git a/test/results/go-modules.json b/test/results/go-modules.json deleted file mode 100644 index b946b60..0000000 --- a/test/results/go-modules.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "licenses": [ - { - "count": 1, - "name": "unknown" - } - ], - "dependencies": [ - { - "license": { - "name": "unknown" - }, - "dependency": { - "name": "golang.org/x/crypto", - "description": "", - "pathes": [ - "." - ] - } - } - ] -} diff --git a/test/results/java-maven-v1.json b/test/results/java-maven-v1.json new file mode 100644 index 0000000..58e9260 --- /dev/null +++ b/test/results/java-maven-v1.json @@ -0,0 +1,505 @@ +{ + "licenses": [ + { + "count": 25, + "name": "Apache 2.0" + }, + { + "count": 3, + "name": "MIT" + }, + { + "count": 2, + "name": "CDDL + GPLv2 with classpath exception" + }, + { + "count": 1, + "name": "BSD" + }, + { + "count": 1, + "name": "BSD style" + }, + { + "count": 1, + "name": "Common Public License Version 1.0" + }, + { + "count": 1, + "name": "LGPL, version 2.1, ASL, version 2" + }, + { + "count": 1, + "name": "MPL 1.1, LGPL 2.1, Apache 2.0" + }, + { + "count": 1, + "name": "Mozilla Public License 2.0" + } + ], + "dependencies": [ + { + "license": { + "name": "BSD", + "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" + }, + "dependency": { + "name": "antlr", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "commons-beanutils", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "commons-io", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "commons-lang", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "commons-lang3", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "fastutil", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "findbugs-annotations", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "geode-common", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "geode-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "geode-json", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "BSD style" + }, + "dependency": { + "name": "hamcrest-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "jackson-annotations", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "jackson-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "jackson-databind", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MPL 1.1, LGPL 2.1, Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "javassist", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "CDDL + GPLv2 with classpath exception" + }, + "dependency": { + "name": "javax.resource-api", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "CDDL + GPLv2 with classpath exception" + }, + "dependency": { + "name": "javax.transaction-api", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "jgroups", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "LGPL, version 2.1, ASL, version 2" + }, + "dependency": { + "name": "jna", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "jopt-simple", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Common Public License Version 1.0" + }, + "dependency": { + "name": "junit", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "log4j-api", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "log4j-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "maven-artifact", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "mockito-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "netty", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "objenesis", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "plexus-utils", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "powermock-api-mockito", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "powermock-api-mockito-common", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "powermock-api-support", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "powermock-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "powermock-reflect", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Mozilla Public License 2.0", + "url": "https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt" + }, + "dependency": { + "name": "rhino", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + }, + "dependency": { + "name": "shiro-core", + "description": "", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "slf4j-api", + "description": "", + "pathes": [ + "." + ] + } + } + ] +} diff --git a/test/results/java-maven.json b/test/results/java-maven.json deleted file mode 100644 index 58e9260..0000000 --- a/test/results/java-maven.json +++ /dev/null @@ -1,505 +0,0 @@ -{ - "licenses": [ - { - "count": 25, - "name": "Apache 2.0" - }, - { - "count": 3, - "name": "MIT" - }, - { - "count": 2, - "name": "CDDL + GPLv2 with classpath exception" - }, - { - "count": 1, - "name": "BSD" - }, - { - "count": 1, - "name": "BSD style" - }, - { - "count": 1, - "name": "Common Public License Version 1.0" - }, - { - "count": 1, - "name": "LGPL, version 2.1, ASL, version 2" - }, - { - "count": 1, - "name": "MPL 1.1, LGPL 2.1, Apache 2.0" - }, - { - "count": 1, - "name": "Mozilla Public License 2.0" - } - ], - "dependencies": [ - { - "license": { - "name": "BSD", - "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" - }, - "dependency": { - "name": "antlr", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "commons-beanutils", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "commons-io", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "commons-lang", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "commons-lang3", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "fastutil", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "findbugs-annotations", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "geode-common", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "geode-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "geode-json", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "BSD style" - }, - "dependency": { - "name": "hamcrest-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "jackson-annotations", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "jackson-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "jackson-databind", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MPL 1.1, LGPL 2.1, Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "javassist", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "CDDL + GPLv2 with classpath exception" - }, - "dependency": { - "name": "javax.resource-api", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "CDDL + GPLv2 with classpath exception" - }, - "dependency": { - "name": "javax.transaction-api", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "jgroups", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "LGPL, version 2.1, ASL, version 2" - }, - "dependency": { - "name": "jna", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "jopt-simple", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Common Public License Version 1.0" - }, - "dependency": { - "name": "junit", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "log4j-api", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "log4j-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "maven-artifact", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "mockito-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "netty", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "objenesis", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "plexus-utils", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "powermock-api-mockito", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "powermock-api-mockito-common", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "powermock-api-support", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "powermock-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "powermock-reflect", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Mozilla Public License 2.0", - "url": "https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt" - }, - "dependency": { - "name": "rhino", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" - }, - "dependency": { - "name": "shiro-core", - "description": "", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "slf4j-api", - "description": "", - "pathes": [ - "." - ] - } - } - ] -} diff --git a/test/results/python-pip-v1.json b/test/results/python-pip-v1.json new file mode 100644 index 0000000..3aa6f39 --- /dev/null +++ b/test/results/python-pip-v1.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/results/python-pip.json b/test/results/python-pip.json deleted file mode 100644 index 3aa6f39..0000000 --- a/test/results/python-pip.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "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/results/python3-pip-v1.json b/test/results/python3-pip-v1.json new file mode 100644 index 0000000..d98669d --- /dev/null +++ b/test/results/python3-pip-v1.json @@ -0,0 +1,212 @@ +{ + "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" + }, + { + "count": 1, + "name": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "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": [ + "." + ] + } + }, + { + "license": { + "name": "http://www.apache.org/licenses/LICENSE-2.0" + }, + "dependency": { + "name": "tornado", + "url": "http://www.tornadoweb.org/", + "description": "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.", + "pathes": [ + "." + ] + } + } + ] +} diff --git a/test/results/python3-pip.json b/test/results/python3-pip.json deleted file mode 100644 index d98669d..0000000 --- a/test/results/python3-pip.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "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" - }, - { - "count": 1, - "name": "http://www.apache.org/licenses/LICENSE-2.0" - } - ], - "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": [ - "." - ] - } - }, - { - "license": { - "name": "http://www.apache.org/licenses/LICENSE-2.0" - }, - "dependency": { - "name": "tornado", - "url": "http://www.tornadoweb.org/", - "description": "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.", - "pathes": [ - "." - ] - } - } - ] -} diff --git a/test/results/ruby-bundler-v1.json b/test/results/ruby-bundler-v1.json new file mode 100644 index 0000000..c66a9a3 --- /dev/null +++ b/test/results/ruby-bundler-v1.json @@ -0,0 +1,242 @@ +{ + "licenses": [ + { + "count": 13, + "name": "MIT" + }, + { + "count": 2, + "name": "New BSD" + }, + { + "count": 1, + "name": "LGPL" + } + ], + "dependencies": [ + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "bundler", + "url": "https://bundler.io", + "description": "The best way to manage your application's dependencies", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "concurrent-ruby", + "url": "http://www.concurrent-ruby.com", + "description": "Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "connection_pool", + "url": "https://github.com/mperham/connection_pool", + "description": "Generic connection pool for Ruby", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "mini_portile2", + "url": "http://github.com/flavorjones/mini_portile", + "description": "Simplistic port-like solution for developers", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "mustermann", + "url": "https://github.com/sinatra/mustermann", + "description": "Your personal string matching expert.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "nokogiri", + "url": "http://nokogiri.org", + "description": "Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "New BSD", + "url": "http://opensource.org/licenses/BSD-3-Clause" + }, + "dependency": { + "name": "pg", + "url": "https://bitbucket.org/ged/ruby-pg", + "description": "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "New BSD", + "url": "http://opensource.org/licenses/BSD-3-Clause" + }, + "dependency": { + "name": "puma", + "url": "http://puma.io", + "description": "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "rack", + "url": "https://rack.github.io/", + "description": "a modular Ruby webserver interface", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "rack-protection", + "url": "http://github.com/sinatra/sinatra/tree/master/rack-protection", + "description": "Protect against typical web attacks, works with all Rack apps, including Rails.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "redis", + "url": "https://github.com/redis/redis-rb", + "description": "A Ruby client library for Redis", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "LGPL", + "url": "http://www.gnu.org/licenses/lgpl.txt" + }, + "dependency": { + "name": "sidekiq", + "url": "http://sidekiq.org", + "description": "Simple, efficient background processing for Ruby", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "sinatra", + "url": "http://www.sinatrarb.com/", + "description": "Classy web-development dressed in a DSL", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "slim", + "url": "http://slim-lang.com/", + "description": "Slim is a template language.", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "temple", + "url": "https://github.com/judofyr/temple", + "description": "Template compilation framework in Ruby", + "pathes": [ + "." + ] + } + }, + { + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/mit-license" + }, + "dependency": { + "name": "tilt", + "url": "http://github.com/rtomayko/tilt/", + "description": "Generic interface to multiple Ruby template engines", + "pathes": [ + "." + ] + } + } + ] +} diff --git a/test/results/ruby-bundler.json b/test/results/ruby-bundler.json deleted file mode 100644 index c66a9a3..0000000 --- a/test/results/ruby-bundler.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "licenses": [ - { - "count": 13, - "name": "MIT" - }, - { - "count": 2, - "name": "New BSD" - }, - { - "count": 1, - "name": "LGPL" - } - ], - "dependencies": [ - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "bundler", - "url": "https://bundler.io", - "description": "The best way to manage your application's dependencies", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "concurrent-ruby", - "url": "http://www.concurrent-ruby.com", - "description": "Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "connection_pool", - "url": "https://github.com/mperham/connection_pool", - "description": "Generic connection pool for Ruby", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "mini_portile2", - "url": "http://github.com/flavorjones/mini_portile", - "description": "Simplistic port-like solution for developers", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "mustermann", - "url": "https://github.com/sinatra/mustermann", - "description": "Your personal string matching expert.", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "nokogiri", - "url": "http://nokogiri.org", - "description": "Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "New BSD", - "url": "http://opensource.org/licenses/BSD-3-Clause" - }, - "dependency": { - "name": "pg", - "url": "https://bitbucket.org/ged/ruby-pg", - "description": "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "New BSD", - "url": "http://opensource.org/licenses/BSD-3-Clause" - }, - "dependency": { - "name": "puma", - "url": "http://puma.io", - "description": "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "rack", - "url": "https://rack.github.io/", - "description": "a modular Ruby webserver interface", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "rack-protection", - "url": "http://github.com/sinatra/sinatra/tree/master/rack-protection", - "description": "Protect against typical web attacks, works with all Rack apps, including Rails.", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "redis", - "url": "https://github.com/redis/redis-rb", - "description": "A Ruby client library for Redis", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "LGPL", - "url": "http://www.gnu.org/licenses/lgpl.txt" - }, - "dependency": { - "name": "sidekiq", - "url": "http://sidekiq.org", - "description": "Simple, efficient background processing for Ruby", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "sinatra", - "url": "http://www.sinatrarb.com/", - "description": "Classy web-development dressed in a DSL", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "slim", - "url": "http://slim-lang.com/", - "description": "Slim is a template language.", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "temple", - "url": "https://github.com/judofyr/temple", - "description": "Template compilation framework in Ruby", - "pathes": [ - "." - ] - } - }, - { - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/mit-license" - }, - "dependency": { - "name": "tilt", - "url": "http://github.com/rtomayko/tilt/", - "description": "Generic interface to multiple Ruby template engines", - "pathes": [ - "." - ] - } - } - ] -} -- cgit v1.2.3 From 1e0553590435977e5f27bcd4b715b4fbca7b595c Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 19 Aug 2019 14:47:24 -0600 Subject: use --pull to remove duplicated image name --- bin/test_all | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/test_all b/bin/test_all index 1aa19b4..c386a7a 100755 --- a/bin/test_all +++ b/bin/test_all @@ -5,8 +5,7 @@ set -e export RESULTS_DIR=`pwd`/tmp export TMP_IMAGE=$(basename $PWD):latest -docker pull licensefinder/license_finder:5.6.2 -docker build . -t $TMP_IMAGE +docker build . -t $TMP_IMAGE --pull REPORT_VERSIONS=(1) for version in "${REPORT_VERSIONS[@]}" -- cgit v1.2.3 From 97b0618b6a8953343a97036862df3ed977167d72 Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 19 Aug 2019 14:55:16 -0600 Subject: Apply changes from https://gitlab.com/gitlab-org/security-products/license-management/merge_requests/50 --- lib/license/management.rb | 3 ++ lib/license/management/json_report.rb | 41 ++++++++++-------- lib/license/management/repository.rb | 7 ++- licenses.yml | 82 ----------------------------------- normalized-licenses.yml | 82 +++++++++++++++++++++++++++++++++++ 5 files changed, 112 insertions(+), 103 deletions(-) delete mode 100644 licenses.yml create mode 100644 normalized-licenses.yml diff --git a/lib/license/management.rb b/lib/license/management.rb index 3b41843..2fdb6b5 100644 --- a/lib/license/management.rb +++ b/lib/license/management.rb @@ -11,6 +11,9 @@ require 'license/management/versions/v1' require 'license/management/json_report' require 'license/management/version' +# This applies a monkey patch to the JsonReport found in the `license_finder` gem. +LicenseFinder::JsonReport.prepend(License::Management::JsonReport) + module License module Management def self.root diff --git a/lib/license/management/json_report.rb b/lib/license/management/json_report.rb index 19a44c4..fde30ef 100644 --- a/lib/license/management/json_report.rb +++ b/lib/license/management/json_report.rb @@ -1,28 +1,31 @@ # frozen_string_literal: true -# This is a monkey patch of the JsonReport found in `license_finder` -module LicenseFinder - class JsonReport < CsvReport - DEFAULT_VERSION = '1' - VERSIONS = { - nil => ::License::Management::Versions::V1, - '' => ::License::Management::Versions::V1, - '1' => ::License::Management::Versions::V1, - '1.0' => ::License::Management::Versions::V1 - }.freeze +module License + module Management + module JsonReport + DEFAULT_VERSION = '1' + VERSIONS = { + nil => ::License::Management::Versions::V1, + '' => ::License::Management::Versions::V1, + '1' => ::License::Management::Versions::V1, + '1.0' => ::License::Management::Versions::V1 + }.freeze - def to_s - JSON.pretty_generate(version_for(report_version).to_h) + "\n" - end + # This method overrides the method defined in `License::Management::JsonReport` to + # allow us to generate a custom json report. + def to_s + JSON.pretty_generate(version_for(report_version).to_h) + "\n" + end - private + private - def report_version - ENV.fetch('LM_REPORT_VERSION', DEFAULT_VERSION) - end + def report_version + ENV.fetch('LM_REPORT_VERSION', DEFAULT_VERSION) + end - def version_for(version) - VERSIONS.fetch(version.to_s).new(dependencies) + def version_for(version) + VERSIONS.fetch(version.to_s).new(dependencies) + end end end end diff --git a/lib/license/management/repository.rb b/lib/license/management/repository.rb index 707d9f0..2eee1b6 100644 --- a/lib/license/management/repository.rb +++ b/lib/license/management/repository.rb @@ -7,14 +7,14 @@ module License include Verifiable def initialize( - compatibility_path: License::Management.root.join('licenses.yml') + compatibility_path: License::Management.root.join('normalized-licenses.yml') ) @compatibility_data = YAML.safe_load(IO.read(compatibility_path)) end def item_for(license) id = id_for(license) - item = id ? compatibility_data['items'][id] : nil + item = id ? compatibility_data['licenses'][id] : nil item ? { 'id' => id }.merge(item) : generate_item_for(license) end @@ -27,6 +27,9 @@ module License ids[license.send(:short_name)] || ids[license.url] end + # When `license_finder` is unable to determine the license it will use the full + # content of the file as the name of the license. This method shrinks that name + # down to just take the first line of the file. def take_first_line_from(content) return '' if blank?(content) diff --git a/licenses.yml b/licenses.yml deleted file mode 100644 index 8ed24b2..0000000 --- a/licenses.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -ids: - ASL, version 2: Apache-2.0 - Apache1_1: Apache-1.1 - Apache2: Apache-2.0 - Apache 2.0: Apache-2.0 - BSD: BSD-4-Clause - CC01: CC0-1.0 - EPL1: EPL-1.0 - GPLv2: GPL-2.0 - GPLv3: GPL-3.0 - ISC: ISC - LGPL 2.1: LGPL-2.1 - LGPL, version 2.1: LGPL-2.1 - LGPL2_1: LGPL-2.1 - LGPL: LGPL-3.0-only - MIT: MIT - MPL 1.1: MPL-1.1 - MPL1_1: MPL-1.1 - MPL2: MPL-2.0 - New BSD License: BSD-3-Clause - NewBSD: BSD-3-Clause - Python: Python-2.0 - Ruby: Ruby - SimplifiedBSD: BSD-2-Clause - http://www.apache.org/licenses/LICENSE-2.0: Apache-2.0 - unknown: unknown -items: - GPL-3.0: - name: GPL 3.0 - url: https://www.gnu.org/licenses/gpl-3.0.txt - BSD-2-Clause: - name: Simplified BSD - url: https://opensource.org/licenses/bsd-license - ISC: - name: ISC - url: https://en.wikipedia.org/wiki/ISC_license - Apache-1.1: - name: Apache 1.1 - url: https://www.apache.org/licenses/LICENSE-1.1.txt - MPL-2.0: - name: Mozilla Public License 2.0 - url: https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt - LGPL-3.0-only: - name: LGPL - url: https://www.gnu.org/licenses/lgpl.txt - CC0-1.0: - name: CC0 1.0 - url: https://creativecommons.org/publicdomain/zero/1.0/ - unknown: - name: unknown - url: '' - GPL-2.0: - name: GPL 2.0 - url: https://www.gnu.org/licenses/gpl-2.0.txt - EPL-1.0: - name: EPL 1.0 - url: https://www.eclipse.org/legal/epl-v10.html - Python-2.0: - name: Python Software Foundation License - url: https://hg.python.org/cpython/raw-file/89ce323357db/LICENSE - BSD-3-Clause: - name: New BSD License - url: https://opensource.org/licenses/BSD-3-Clause - MIT: - name: MIT - url: https://opensource.org/licenses/mit-license - LGPL-2.1: - name: LGPL 2.1 - url: https://opensource.org/licenses/LGPL-2.1 - Ruby: - name: Ruby - url: https://www.ruby-lang.org/en/about/license.txt - Apache-2.0: - name: Apache 2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.txt - MPL-1.1: - name: MPL 1.1 - url: https://www.mozilla.org/en-US/MPL/1.1/ - BSD-4-Clause: - name: BSD - url: https://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29 diff --git a/normalized-licenses.yml b/normalized-licenses.yml new file mode 100644 index 0000000..e26df4f --- /dev/null +++ b/normalized-licenses.yml @@ -0,0 +1,82 @@ +--- +ids: + ASL, version 2: Apache-2.0 + Apache1_1: Apache-1.1 + Apache2: Apache-2.0 + Apache 2.0: Apache-2.0 + BSD: BSD-4-Clause + CC01: CC0-1.0 + EPL1: EPL-1.0 + GPLv2: GPL-2.0 + GPLv3: GPL-3.0 + ISC: ISC + LGPL 2.1: LGPL-2.1 + LGPL, version 2.1: LGPL-2.1 + LGPL2_1: LGPL-2.1 + LGPL: LGPL-3.0-only + MIT: MIT + MPL 1.1: MPL-1.1 + MPL1_1: MPL-1.1 + MPL2: MPL-2.0 + New BSD License: BSD-3-Clause + NewBSD: BSD-3-Clause + Python: Python-2.0 + Ruby: Ruby + SimplifiedBSD: BSD-2-Clause + http://www.apache.org/licenses/LICENSE-2.0: Apache-2.0 + unknown: unknown +licenses: + GPL-3.0: + name: GPL 3.0 + url: https://www.gnu.org/licenses/gpl-3.0.txt + BSD-2-Clause: + name: Simplified BSD + url: https://opensource.org/licenses/bsd-license + ISC: + name: ISC + url: https://en.wikipedia.org/wiki/ISC_license + Apache-1.1: + name: Apache 1.1 + url: https://www.apache.org/licenses/LICENSE-1.1.txt + MPL-2.0: + name: Mozilla Public License 2.0 + url: https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt + LGPL-3.0-only: + name: LGPL + url: https://www.gnu.org/licenses/lgpl.txt + CC0-1.0: + name: CC0 1.0 + url: https://creativecommons.org/publicdomain/zero/1.0/ + unknown: + name: unknown + url: '' + GPL-2.0: + name: GPL 2.0 + url: https://www.gnu.org/licenses/gpl-2.0.txt + EPL-1.0: + name: EPL 1.0 + url: https://www.eclipse.org/legal/epl-v10.html + Python-2.0: + name: Python Software Foundation License + url: https://hg.python.org/cpython/raw-file/89ce323357db/LICENSE + BSD-3-Clause: + name: New BSD License + url: https://opensource.org/licenses/BSD-3-Clause + MIT: + name: MIT + url: https://opensource.org/licenses/mit-license + LGPL-2.1: + name: LGPL 2.1 + url: https://opensource.org/licenses/LGPL-2.1 + Ruby: + name: Ruby + url: https://www.ruby-lang.org/en/about/license.txt + Apache-2.0: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.txt + MPL-1.1: + name: MPL 1.1 + url: https://www.mozilla.org/en-US/MPL/1.1/ + BSD-4-Clause: + name: BSD + url: https://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29 -- cgit v1.2.3 From cf6b1d9b21680c6780c7f77d5afaa94b2220fff9 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 12:00:20 -0600 Subject: remove empty line from CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73eac53..5549dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,6 @@ - Convert HTML to JSON transformation to generating a JSON report directly. - ## v1.5.0 - Reverts 1.4.0 -- cgit v1.2.3 From ced12c2b14be4db7c05dd5d24df5eb5038d933d2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 12:00:37 -0600 Subject: remove unnecessary parentheses --- lib/license/management/versions/v1.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/license/management/versions/v1.rb b/lib/license/management/versions/v1.rb index d448397..abaa1d8 100644 --- a/lib/license/management/versions/v1.rb +++ b/lib/license/management/versions/v1.rb @@ -20,7 +20,7 @@ module License .map { |x| x.licenses.map { |y| best_name_for(y) }.sort.reverse.join(', ') } .flatten .group_by { |name| name } - .map { |(license, items)| { count: items.count, name: license } } + .map { |license, items| { count: items.count, name: license } } .sort_by { |x| [-x[:count], x[:name]] } end -- cgit v1.2.3 From 033e0908666c1b67e9958ee22c2a18459cb2db99 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 12:03:57 -0600 Subject: replace ternary with hash initialization --- lib/license/management/versions/v1.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/license/management/versions/v1.rb b/lib/license/management/versions/v1.rb index abaa1d8..6eb3f36 100644 --- a/lib/license/management/versions/v1.rb +++ b/lib/license/management/versions/v1.rb @@ -28,11 +28,14 @@ module License # this method chooses one of the urls. # to maintain backwards compatibility this bug has been carried forward. def license_for(dependency) - name = join_license_names(dependency.licenses) + license = { name: join_license_names(dependency.licenses) } + urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 url = urls[0] || data_for(dependency.licenses.first)['url'] - blank?(url) ? { name: name } : { name: name, url: url } + + license.merge(url: url) if present?(url) + license end def join_license_names(licenses) -- cgit v1.2.3 From 5100c31f3b8befd24c40a95d957122084f90f08c Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 12:38:13 -0600 Subject: use better intention revealing names --- lib/license/management/versions/v1.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/license/management/versions/v1.rb b/lib/license/management/versions/v1.rb index 6eb3f36..f7de2e6 100644 --- a/lib/license/management/versions/v1.rb +++ b/lib/license/management/versions/v1.rb @@ -14,14 +14,14 @@ module License private # when a dependency has multiple licenses, this will join the licenses into a single name - # this defect was backported from the htmltojson version of this script. + # this defect was backported from the html2json version of this script. def license_summary dependencies - .map { |x| x.licenses.map { |y| best_name_for(y) }.sort.reverse.join(', ') } + .map { |dependency| join_license_names(dependency.licenses) } .flatten .group_by { |name| name } .map { |license, items| { count: items.count, name: license } } - .sort_by { |x| [-x[:count], x[:name]] } + .sort_by { |hash| [-hash[:count], hash[:name]] } end # when a dependency has more than one license @@ -32,14 +32,14 @@ module License urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 - url = urls[0] || data_for(dependency.licenses.first)['url'] + url = urls[0] || license_data(dependency.licenses.first)['url'] license.merge(url: url) if present?(url) license end def join_license_names(licenses) - licenses.map { |x| best_name_for(x) }.join(', ') + licenses.map { |x| best_name_for(x) }.sort.reverse.join(', ') end def map_from_dependency(dependency) @@ -63,10 +63,10 @@ module License end def best_name_for(license) - data_for(license)['name'] + license_data(license)['name'] end - def data_for(license) + def license_data(license) repository.item_for(license) end end -- cgit v1.2.3 From 4614246f0edf72ebcdf2e45aa05d1736cd3358f1 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 12:40:03 -0600 Subject: provide default implementation of template method and use safe navigation operator --- lib/license/management/versions/base.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/license/management/versions/base.rb b/lib/license/management/versions/base.rb index 6e30e20..2345a50 100644 --- a/lib/license/management/versions/base.rb +++ b/lib/license/management/versions/base.rb @@ -14,10 +14,15 @@ module License @repository = License::Management::Repository.new end + def to_h + raise NotImplementedError + end + private + def paths_from(dependency) - return [] unless dependency.respond_to?(:aggregate_paths) + return [] unless dependency&.respond_to?(:aggregate_paths) paths = dependency.aggregate_paths return [] if blank?(paths) -- cgit v1.2.3 From 5464af2b80a9f3da931d07b45428049f9de2ef76 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 12:44:12 -0600 Subject: add mo to list of authors. :) --- license-management.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/license-management.gemspec b/license-management.gemspec index 99cb1b1..a4b6daa 100644 --- a/license-management.gemspec +++ b/license-management.gemspec @@ -7,8 +7,8 @@ require 'license/management/version' Gem::Specification.new do |spec| spec.name = 'license-management' spec.version = License::Management::VERSION - spec.authors = ['Fabien Catteau', 'Olivier Gonzalez'] - spec.email = ['fcatteau@gitlab.com', 'ogonzalez@gitlab.com'] + spec.authors = ['Fabien Catteau', 'Olivier Gonzalez', 'mo khan'] + spec.email = ['fcatteau@gitlab.com', 'ogonzalez@gitlab.com', 'mkhan@gitlab.com'] spec.summary = 'License Management job for GitLab CI.' spec.description = 'License Management job for GitLab CI.' -- cgit v1.2.3 From 026959fcbe2fb0fa7b37a8b64a54d7672a065eac Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 15:18:43 -0600 Subject: update gem version # to match CHANGELOG entry --- lib/license/management/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/license/management/version.rb b/lib/license/management/version.rb index d679b3f..7fec52d 100644 --- a/lib/license/management/version.rb +++ b/lib/license/management/version.rb @@ -2,6 +2,6 @@ module License module Management - VERSION = '1.6.0' + VERSION = '1.7.0' end end -- cgit v1.2.3 From 9e6dc27364de7d6df94a0b8ca57c9027b2292733 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 15:26:00 -0600 Subject: remove redundant declaration of QA_RESULTS --- bin/test_all | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/test_all b/bin/test_all index c386a7a..c96c2e1 100755 --- a/bin/test_all +++ b/bin/test_all @@ -12,9 +12,9 @@ for version in "${REPORT_VERSIONS[@]}" do export LM_REPORT_VERSION=$version echo "Report Version $LM_REPORT_VERSION" - QA_PROJECT=go-modules QA_RESULTS="go-modules-v$version" QA_REF=master ./bin/test - QA_PROJECT=java-maven QA_RESULTS="java-maven-v$version" QA_REF=831c7a04 ./bin/test - QA_PROJECT=python-pip QA_RESULTS="python-pip-v$version" QA_REF=04dce91b LM_PYTHON_VERSION=2 ./bin/test + QA_PROJECT=go-modules QA_REF=master ./bin/test + QA_PROJECT=java-maven QA_REF=831c7a04 ./bin/test + QA_PROJECT=python-pip QA_REF=04dce91b LM_PYTHON_VERSION=2 ./bin/test QA_PROJECT=python-pip QA_RESULTS="python3-pip-v$version" QA_REF=48e250a1 LM_PYTHON_VERSION=3 ./bin/test - QA_PROJECT=ruby-bundler QA_RESULTS="ruby-bundler-v$version" QA_REF=6b858821 ./bin/test + QA_PROJECT=ruby-bundler QA_REF=6b858821 ./bin/test done -- cgit v1.2.3 From d6c503e2347cb75df398f8cd88bb2623b34273a4 Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 20 Aug 2019 17:02:22 -0600 Subject: assign to current hash instead of new one --- lib/license/management/versions/v1.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/license/management/versions/v1.rb b/lib/license/management/versions/v1.rb index f7de2e6..1ef81c0 100644 --- a/lib/license/management/versions/v1.rb +++ b/lib/license/management/versions/v1.rb @@ -34,7 +34,7 @@ module License log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 url = urls[0] || license_data(dependency.licenses.first)['url'] - license.merge(url: url) if present?(url) + license[:url] = url if present?(url) license end -- cgit v1.2.3 From 170f3bee921b24f9ee12191662afe68aea2e8788 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 21 Aug 2019 10:21:58 -0600 Subject: remove unnecessary usage of safe navigation operator --- lib/license/management/versions/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/license/management/versions/base.rb b/lib/license/management/versions/base.rb index 2345a50..a087520 100644 --- a/lib/license/management/versions/base.rb +++ b/lib/license/management/versions/base.rb @@ -22,7 +22,7 @@ module License def paths_from(dependency) - return [] unless dependency&.respond_to?(:aggregate_paths) + return [] unless dependency.respond_to?(:aggregate_paths) paths = dependency.aggregate_paths return [] if blank?(paths) -- cgit v1.2.3 From 27888daf19c84e646ffdae7a635f38db8bc05cdb Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 21 Aug 2019 10:31:01 -0600 Subject: Move version classes to Report namespace --- lib/license/management.rb | 6 +- lib/license/management/json_report.rb | 31 ----------- lib/license/management/report.rb | 34 ++++++++++++ lib/license/management/report/versions/base.rb | 40 +++++++++++++ lib/license/management/report/versions/v1.rb | 77 ++++++++++++++++++++++++++ lib/license/management/versions/base.rb | 39 ------------- lib/license/management/versions/v1.rb | 75 ------------------------- 7 files changed, 153 insertions(+), 149 deletions(-) delete mode 100644 lib/license/management/json_report.rb create mode 100644 lib/license/management/report.rb create mode 100644 lib/license/management/report/versions/base.rb create mode 100644 lib/license/management/report/versions/v1.rb delete mode 100644 lib/license/management/versions/base.rb delete mode 100644 lib/license/management/versions/v1.rb diff --git a/lib/license/management.rb b/lib/license/management.rb index 2fdb6b5..64fd4e8 100644 --- a/lib/license/management.rb +++ b/lib/license/management.rb @@ -6,13 +6,11 @@ require 'license_finder' require 'license/management/loggable' require 'license/management/verifiable' require 'license/management/repository' -require 'license/management/versions/base' -require 'license/management/versions/v1' -require 'license/management/json_report' +require 'license/management/report' require 'license/management/version' # This applies a monkey patch to the JsonReport found in the `license_finder` gem. -LicenseFinder::JsonReport.prepend(License::Management::JsonReport) +LicenseFinder::JsonReport.prepend(License::Management::Report) module License module Management diff --git a/lib/license/management/json_report.rb b/lib/license/management/json_report.rb deleted file mode 100644 index fde30ef..0000000 --- a/lib/license/management/json_report.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -module License - module Management - module JsonReport - DEFAULT_VERSION = '1' - VERSIONS = { - nil => ::License::Management::Versions::V1, - '' => ::License::Management::Versions::V1, - '1' => ::License::Management::Versions::V1, - '1.0' => ::License::Management::Versions::V1 - }.freeze - - # This method overrides the method defined in `License::Management::JsonReport` to - # allow us to generate a custom json report. - def to_s - JSON.pretty_generate(version_for(report_version).to_h) + "\n" - end - - private - - def report_version - ENV.fetch('LM_REPORT_VERSION', DEFAULT_VERSION) - end - - def version_for(version) - VERSIONS.fetch(version.to_s).new(dependencies) - end - end - end -end diff --git a/lib/license/management/report.rb b/lib/license/management/report.rb new file mode 100644 index 0000000..40fa854 --- /dev/null +++ b/lib/license/management/report.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'license/management/report/versions/base' +require 'license/management/report/versions/v1' + +module License + module Management + module Report + DEFAULT_VERSION = '1' + VERSIONS = { + nil => Versions::V1, + '' => Versions::V1, + '1' => Versions::V1, + '1.0' => Versions::V1 + }.freeze + + # This method overrides the method defined in `LicenseFinder::JsonReport` to + # allow us to generate a custom json report. + def to_s + JSON.pretty_generate(version_for(report_version).to_h) + "\n" + end + + private + + def report_version + ENV.fetch('LM_REPORT_VERSION', DEFAULT_VERSION) + end + + def version_for(version) + VERSIONS.fetch(version.to_s).new(dependencies) + end + end + end +end diff --git a/lib/license/management/report/versions/base.rb b/lib/license/management/report/versions/base.rb new file mode 100644 index 0000000..68bd41f --- /dev/null +++ b/lib/license/management/report/versions/base.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module License + module Management + module Report + module Versions + class Base + include Loggable + include Verifiable + + attr_reader :dependencies, :repository + + def initialize(dependencies) + @dependencies = dependencies + @repository = License::Management::Repository.new + end + + def to_h + raise NotImplementedError + end + + private + + def paths_from(dependency) + return [] unless dependency.respond_to?(:aggregate_paths) + + paths = dependency.aggregate_paths + return [] if blank?(paths) + + paths.map { |x| x.gsub(Dir.pwd, '.') } + end + + def description_for(dependency) + present?(dependency.summary) ? dependency.summary : dependency.description + end + end + end + end + end +end diff --git a/lib/license/management/report/versions/v1.rb b/lib/license/management/report/versions/v1.rb new file mode 100644 index 0000000..c14864b --- /dev/null +++ b/lib/license/management/report/versions/v1.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module License + module Management + module Report + module Versions + class V1 < Base + def to_h + { + licenses: license_summary, + dependencies: formatted_dependencies(dependencies) + } + end + + private + + # when a dependency has multiple licenses, this will join the licenses into a single name + # this defect was backported from the html2json version of this script. + def license_summary + dependencies + .map { |dependency| join_license_names(dependency.licenses) } + .flatten + .group_by { |name| name } + .map { |license, items| { count: items.count, name: license } } + .sort_by { |hash| [-hash[:count], hash[:name]] } + end + + # when a dependency has more than one license + # this method chooses one of the urls. + # to maintain backwards compatibility this bug has been carried forward. + def license_for(dependency) + license = { name: join_license_names(dependency.licenses) } + + urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort + log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 + url = urls[0] || license_data(dependency.licenses.first)['url'] + + license[:url] = url if present?(url) + license + end + + def join_license_names(licenses) + licenses.map { |x| best_name_for(x) }.sort.reverse.join(', ') + end + + def map_from_dependency(dependency) + result = { + license: license_for(dependency), + dependency: { + name: dependency.name, + url: dependency.homepage, + description: description_for(dependency), + pathes: paths_from(dependency) + } + } + result[:dependency].delete(:url) if blank?(dependency.homepage) + result + end + + def formatted_dependencies(dependencies) + dependencies + .sort_by(&:name) + .map { |x| map_from_dependency(x) } + end + + def best_name_for(license) + license_data(license)['name'] + end + + def license_data(license) + repository.item_for(license) + end + end + end + end + end +end diff --git a/lib/license/management/versions/base.rb b/lib/license/management/versions/base.rb deleted file mode 100644 index a087520..0000000 --- a/lib/license/management/versions/base.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module License - module Management - module Versions - class Base - include Loggable - include Verifiable - - attr_reader :dependencies, :repository - - def initialize(dependencies) - @dependencies = dependencies - @repository = License::Management::Repository.new - end - - def to_h - raise NotImplementedError - end - - private - - - def paths_from(dependency) - return [] unless dependency.respond_to?(:aggregate_paths) - - paths = dependency.aggregate_paths - return [] if blank?(paths) - - paths.map { |x| x.gsub(Dir.pwd, '.') } - end - - def description_for(dependency) - present?(dependency.summary) ? dependency.summary : dependency.description - end - end - end - end -end diff --git a/lib/license/management/versions/v1.rb b/lib/license/management/versions/v1.rb deleted file mode 100644 index 1ef81c0..0000000 --- a/lib/license/management/versions/v1.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -module License - module Management - module Versions - class V1 < Base - def to_h - { - licenses: license_summary, - dependencies: formatted_dependencies(dependencies) - } - end - - private - - # when a dependency has multiple licenses, this will join the licenses into a single name - # this defect was backported from the html2json version of this script. - def license_summary - dependencies - .map { |dependency| join_license_names(dependency.licenses) } - .flatten - .group_by { |name| name } - .map { |license, items| { count: items.count, name: license } } - .sort_by { |hash| [-hash[:count], hash[:name]] } - end - - # when a dependency has more than one license - # this method chooses one of the urls. - # to maintain backwards compatibility this bug has been carried forward. - def license_for(dependency) - license = { name: join_license_names(dependency.licenses) } - - urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort - log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 - url = urls[0] || license_data(dependency.licenses.first)['url'] - - license[:url] = url if present?(url) - license - end - - def join_license_names(licenses) - licenses.map { |x| best_name_for(x) }.sort.reverse.join(', ') - end - - def map_from_dependency(dependency) - result = { - license: license_for(dependency), - dependency: { - name: dependency.name, - url: dependency.homepage, - description: description_for(dependency), - pathes: paths_from(dependency) - } - } - result[:dependency].delete(:url) if blank?(dependency.homepage) - result - end - - def formatted_dependencies(dependencies) - dependencies - .sort_by(&:name) - .map { |x| map_from_dependency(x) } - end - - def best_name_for(license) - license_data(license)['name'] - end - - def license_data(license) - repository.item_for(license) - end - end - end - end -end -- cgit v1.2.3 From 450d9b983df6c616f74759c59a7e1ae1098a2dff Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 21 Aug 2019 13:58:21 -0600 Subject: add way to choose canonical or non canonical form in v1 reports --- lib/license/management/report/versions/v1.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/license/management/report/versions/v1.rb b/lib/license/management/report/versions/v1.rb index c14864b..e897960 100644 --- a/lib/license/management/report/versions/v1.rb +++ b/lib/license/management/report/versions/v1.rb @@ -68,7 +68,16 @@ module License end def license_data(license) - repository.item_for(license) + return repository.item_for(license) if canonicalize? + + { + 'name' => license.name.split(/[\r\n]+/)[0], + 'url' => license.url + } + end + + def canonicalize? + ENV.fetch('LM_V1_CANONICALIZE', 'false') == 'true' end end end -- cgit v1.2.3 From 47d34c5b04ccb0018329cb35cb587911510d7f3e Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 21 Aug 2019 14:05:52 -0600 Subject: collapse versions namespace --- lib/license/management/report.rb | 12 ++-- lib/license/management/report/base.rb | 38 ++++++++++++ lib/license/management/report/v1.rb | 84 +++++++++++++++++++++++++ lib/license/management/report/versions/base.rb | 40 ------------ lib/license/management/report/versions/v1.rb | 86 -------------------------- 5 files changed, 128 insertions(+), 132 deletions(-) create mode 100644 lib/license/management/report/base.rb create mode 100644 lib/license/management/report/v1.rb delete mode 100644 lib/license/management/report/versions/base.rb delete mode 100644 lib/license/management/report/versions/v1.rb diff --git a/lib/license/management/report.rb b/lib/license/management/report.rb index 40fa854..5ac41bb 100644 --- a/lib/license/management/report.rb +++ b/lib/license/management/report.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true -require 'license/management/report/versions/base' -require 'license/management/report/versions/v1' +require 'license/management/report/base' +require 'license/management/report/v1' module License module Management module Report DEFAULT_VERSION = '1' VERSIONS = { - nil => Versions::V1, - '' => Versions::V1, - '1' => Versions::V1, - '1.0' => Versions::V1 + nil => V1, + '' => V1, + '1' => V1, + '1.0' => V1 }.freeze # This method overrides the method defined in `LicenseFinder::JsonReport` to diff --git a/lib/license/management/report/base.rb b/lib/license/management/report/base.rb new file mode 100644 index 0000000..ab9b6a1 --- /dev/null +++ b/lib/license/management/report/base.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module License + module Management + module Report + class Base + include Loggable + include Verifiable + + attr_reader :dependencies, :repository + + def initialize(dependencies) + @dependencies = dependencies + @repository = License::Management::Repository.new + end + + def to_h + raise NotImplementedError + end + + private + + def paths_from(dependency) + return [] unless dependency.respond_to?(:aggregate_paths) + + paths = dependency.aggregate_paths + return [] if blank?(paths) + + paths.map { |x| x.gsub(Dir.pwd, '.') } + end + + def description_for(dependency) + present?(dependency.summary) ? dependency.summary : dependency.description + end + end + end + end +end diff --git a/lib/license/management/report/v1.rb b/lib/license/management/report/v1.rb new file mode 100644 index 0000000..5882f72 --- /dev/null +++ b/lib/license/management/report/v1.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module License + module Management + module Report + class V1 < Base + def to_h + { + licenses: license_summary, + dependencies: formatted_dependencies(dependencies) + } + end + + private + + # when a dependency has multiple licenses, this will join the licenses into a single name + # this defect was backported from the html2json version of this script. + def license_summary + dependencies + .map { |dependency| join_license_names(dependency.licenses) } + .flatten + .group_by { |name| name } + .map { |license, items| { count: items.count, name: license } } + .sort_by { |hash| [-hash[:count], hash[:name]] } + end + + # when a dependency has more than one license + # this method chooses one of the urls. + # to maintain backwards compatibility this bug has been carried forward. + def license_for(dependency) + license = { name: join_license_names(dependency.licenses) } + + urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort + log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 + url = urls[0] || license_data(dependency.licenses.first)['url'] + + license[:url] = url if present?(url) + license + end + + def join_license_names(licenses) + licenses.map { |x| best_name_for(x) }.sort.reverse.join(', ') + end + + def map_from_dependency(dependency) + result = { + license: license_for(dependency), + dependency: { + name: dependency.name, + url: dependency.homepage, + description: description_for(dependency), + pathes: paths_from(dependency) + } + } + result[:dependency].delete(:url) if blank?(dependency.homepage) + result + end + + def formatted_dependencies(dependencies) + dependencies + .sort_by(&:name) + .map { |x| map_from_dependency(x) } + end + + def best_name_for(license) + license_data(license)['name'] + end + + def license_data(license) + return repository.item_for(license) if canonicalize? + + { + 'name' => license.name.split(/[\r\n]+/)[0], + 'url' => license.url + } + end + + def canonicalize? + ENV.fetch('LM_V1_CANONICALIZE', 'false') == 'true' + end + end + end + end +end diff --git a/lib/license/management/report/versions/base.rb b/lib/license/management/report/versions/base.rb deleted file mode 100644 index 68bd41f..0000000 --- a/lib/license/management/report/versions/base.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module License - module Management - module Report - module Versions - class Base - include Loggable - include Verifiable - - attr_reader :dependencies, :repository - - def initialize(dependencies) - @dependencies = dependencies - @repository = License::Management::Repository.new - end - - def to_h - raise NotImplementedError - end - - private - - def paths_from(dependency) - return [] unless dependency.respond_to?(:aggregate_paths) - - paths = dependency.aggregate_paths - return [] if blank?(paths) - - paths.map { |x| x.gsub(Dir.pwd, '.') } - end - - def description_for(dependency) - present?(dependency.summary) ? dependency.summary : dependency.description - end - end - end - end - end -end diff --git a/lib/license/management/report/versions/v1.rb b/lib/license/management/report/versions/v1.rb deleted file mode 100644 index e897960..0000000 --- a/lib/license/management/report/versions/v1.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -module License - module Management - module Report - module Versions - class V1 < Base - def to_h - { - licenses: license_summary, - dependencies: formatted_dependencies(dependencies) - } - end - - private - - # when a dependency has multiple licenses, this will join the licenses into a single name - # this defect was backported from the html2json version of this script. - def license_summary - dependencies - .map { |dependency| join_license_names(dependency.licenses) } - .flatten - .group_by { |name| name } - .map { |license, items| { count: items.count, name: license } } - .sort_by { |hash| [-hash[:count], hash[:name]] } - end - - # when a dependency has more than one license - # this method chooses one of the urls. - # to maintain backwards compatibility this bug has been carried forward. - def license_for(dependency) - license = { name: join_license_names(dependency.licenses) } - - urls = dependency.licenses.map(&:url).reject { |x| blank?(x) }.uniq.sort - log_info("multiple urls detected: #{urls.inspect}") if urls.size > 1 - url = urls[0] || license_data(dependency.licenses.first)['url'] - - license[:url] = url if present?(url) - license - end - - def join_license_names(licenses) - licenses.map { |x| best_name_for(x) }.sort.reverse.join(', ') - end - - def map_from_dependency(dependency) - result = { - license: license_for(dependency), - dependency: { - name: dependency.name, - url: dependency.homepage, - description: description_for(dependency), - pathes: paths_from(dependency) - } - } - result[:dependency].delete(:url) if blank?(dependency.homepage) - result - end - - def formatted_dependencies(dependencies) - dependencies - .sort_by(&:name) - .map { |x| map_from_dependency(x) } - end - - def best_name_for(license) - license_data(license)['name'] - end - - def license_data(license) - return repository.item_for(license) if canonicalize? - - { - 'name' => license.name.split(/[\r\n]+/)[0], - 'url' => license.url - } - end - - def canonicalize? - ENV.fetch('LM_V1_CANONICALIZE', 'false') == 'true' - end - end - end - end - end -end -- cgit v1.2.3 From 532e36e31622cba5566e09e23e1fb3cc84d0c666 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 10:23:40 -0600 Subject: release old images using html2json.js script and v1 report only --- .gitlab-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d71489..69756f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,6 +49,12 @@ container_scanning: - results/ when: always +.legacy-v1-variables: + variables: + FEATURE_RUBY_REPORT: 'false' + LM_REPORT_VERSION: 1 + LM_V1_CANONICALIZE: 'false' + QA:java-maven: extends: .QA variables: @@ -170,45 +176,60 @@ latest: 12-2-stable: extends: .release + extends: .legacy-v1-variables 12-1-stable: extends: .release_python2 + extends: .legacy-v1-variables 12-0-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-11-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-10-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-9-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-8-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-7-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-6-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-5-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-4-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-3-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-2-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-1-stable: extends: .release_python2 + extends: .legacy-v1-variables 11-0-stable: extends: .release_python2 + extends: .legacy-v1-variables -- cgit v1.2.3 From b94b08f7441372074a0b0286837eb25c2ff9ad11 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 10:25:20 -0600 Subject: release 12-3 image with v1 report generated via direct ruby integration --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69756f0..aa62a7e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -173,6 +173,10 @@ latest: 12-3-stable: extends: .release + variables: + FEATURE_RUBY_REPORT: 'true' + LM_REPORT_VERSION: 1 + LM_V1_CANONICALIZE: 'false' 12-2-stable: extends: .release -- cgit v1.2.3 From ead82e380d385450df7e507d1cb9cca15804ee5a Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:38:50 -0600 Subject: create script to inject environment variables into an existing image --- .gitignore | 1 + .gitlab-ci.yml | 11 ++++++++--- bin/docker-inject-env | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100755 bin/docker-inject-env diff --git a/.gitignore b/.gitignore index a9a5aec..8462f59 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ tmp +Dockerfile.env diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa62a7e..14584f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,9 +51,14 @@ container_scanning: .legacy-v1-variables: variables: - FEATURE_RUBY_REPORT: 'false' - LM_REPORT_VERSION: 1 - LM_V1_CANONICALIZE: 'false' + DOTENV: "FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;LM_V1_CANONICALIZE 'false';" + script: + - docker info + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - export SOURCE_IMAGE=$TMP_IMAGE + - export TARGET_IMAGE=$CI_REGISTRY_IMAGE:${IMAGE_TAG:-$CI_JOB_NAME} + - ./bin/docker-inject-env + - docker push $TARGET_IMAGE QA:java-maven: extends: .QA diff --git a/bin/docker-inject-env b/bin/docker-inject-env new file mode 100755 index 0000000..e404cec --- /dev/null +++ b/bin/docker-inject-env @@ -0,0 +1,24 @@ +#!/bin/sh + +# input: +# SOURCE_IMAGE: Image name for the source image +# TARGET_IMAGE: Name of image to build +# DOTENV: The list of env variables delimited by a ; +# e.g. DOTENV="FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;" + +set -e + +cd "$(dirname "$0")/.." +DOCKERFILE=Dockerfile.env + +rm -f $DOCKERFILE +touch $DOCKERFILE +echo "FROM $SOURCE_IMAGE" > $DOCKERFILE + +IFS=';' read -ra EACH_ENV <<< "$DOTENV" +for i in "${EACH_ENV[@]}"; do + echo "ENV $i" >> $DOCKERFILE +done + +docker pull $SOURCE_IMAGE +docker build -t $TARGET_IMAGE -f $DOCKERFILE . -- cgit v1.2.3 From 8e19a8a9e849883e47daa4873d6c992537eaa9e1 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:39:41 -0600 Subject: rename script to docker-dotenv --- bin/docker-dotenv | 24 ++++++++++++++++++++++++ bin/docker-inject-env | 24 ------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100755 bin/docker-dotenv delete mode 100755 bin/docker-inject-env diff --git a/bin/docker-dotenv b/bin/docker-dotenv new file mode 100755 index 0000000..e404cec --- /dev/null +++ b/bin/docker-dotenv @@ -0,0 +1,24 @@ +#!/bin/sh + +# input: +# SOURCE_IMAGE: Image name for the source image +# TARGET_IMAGE: Name of image to build +# DOTENV: The list of env variables delimited by a ; +# e.g. DOTENV="FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;" + +set -e + +cd "$(dirname "$0")/.." +DOCKERFILE=Dockerfile.env + +rm -f $DOCKERFILE +touch $DOCKERFILE +echo "FROM $SOURCE_IMAGE" > $DOCKERFILE + +IFS=';' read -ra EACH_ENV <<< "$DOTENV" +for i in "${EACH_ENV[@]}"; do + echo "ENV $i" >> $DOCKERFILE +done + +docker pull $SOURCE_IMAGE +docker build -t $TARGET_IMAGE -f $DOCKERFILE . diff --git a/bin/docker-inject-env b/bin/docker-inject-env deleted file mode 100755 index e404cec..0000000 --- a/bin/docker-inject-env +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# input: -# SOURCE_IMAGE: Image name for the source image -# TARGET_IMAGE: Name of image to build -# DOTENV: The list of env variables delimited by a ; -# e.g. DOTENV="FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;" - -set -e - -cd "$(dirname "$0")/.." -DOCKERFILE=Dockerfile.env - -rm -f $DOCKERFILE -touch $DOCKERFILE -echo "FROM $SOURCE_IMAGE" > $DOCKERFILE - -IFS=';' read -ra EACH_ENV <<< "$DOTENV" -for i in "${EACH_ENV[@]}"; do - echo "ENV $i" >> $DOCKERFILE -done - -docker pull $SOURCE_IMAGE -docker build -t $TARGET_IMAGE -f $DOCKERFILE . -- cgit v1.2.3 From fa501723ff51d5d0cfd4e345c249d2c0ddc77814 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:50:34 -0600 Subject: read .env files instead of hardcoding in .gitlab-ci.yml file --- .dockerignore | 1 + .env.12-3-stable | 3 +++ .env.legacy | 4 ++++ .gitlab-ci.yml | 13 +++++++------ bin/docker-dotenv | 8 ++++---- 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 .env.12-3-stable create mode 100644 .env.legacy diff --git a/.dockerignore b/.dockerignore index 6b8710a..1d4e811 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ .git +.env.* diff --git a/.env.12-3-stable b/.env.12-3-stable new file mode 100644 index 0000000..edb6a67 --- /dev/null +++ b/.env.12-3-stable @@ -0,0 +1,3 @@ +FEATURE_RUBY_REPORT 'true' +LM_REPORT_VERSION 1 +LM_V1_CANONICALIZE 'false' diff --git a/.env.legacy b/.env.legacy new file mode 100644 index 0000000..bba5f11 --- /dev/null +++ b/.env.legacy @@ -0,0 +1,4 @@ +FEATURE_RUBY_REPORT 'false' +LM_PYTHON_VERSION 2.7 +LM_REPORT_VERSION 1 +LM_V1_CANONICALIZE 'false' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14584f4..8ce16d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,9 +49,7 @@ container_scanning: - results/ when: always -.legacy-v1-variables: - variables: - DOTENV: "FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;LM_V1_CANONICALIZE 'false';" +.dotenv: script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY @@ -60,6 +58,11 @@ container_scanning: - ./bin/docker-inject-env - docker push $TARGET_IMAGE +.legacy-v1-variables: + extends: .dotenv + variables: + DOTENV: ".env.legacy" + QA:java-maven: extends: .QA variables: @@ -179,9 +182,7 @@ latest: 12-3-stable: extends: .release variables: - FEATURE_RUBY_REPORT: 'true' - LM_REPORT_VERSION: 1 - LM_V1_CANONICALIZE: 'false' + DOTENV: ".env.legacy" 12-2-stable: extends: .release diff --git a/bin/docker-dotenv b/bin/docker-dotenv index e404cec..1c9544d 100755 --- a/bin/docker-dotenv +++ b/bin/docker-dotenv @@ -15,10 +15,10 @@ rm -f $DOCKERFILE touch $DOCKERFILE echo "FROM $SOURCE_IMAGE" > $DOCKERFILE -IFS=';' read -ra EACH_ENV <<< "$DOTENV" -for i in "${EACH_ENV[@]}"; do - echo "ENV $i" >> $DOCKERFILE -done +while IFS= read -r line; do + echo "ENV $line" >> $DOCKERFILE +done < $DOTENV docker pull $SOURCE_IMAGE docker build -t $TARGET_IMAGE -f $DOCKERFILE . +docker run $TARGET_IMAGE env -- cgit v1.2.3 From cc75be07e97c73ab7da419912abbc123c756312d Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:51:29 -0600 Subject: update example documentation --- bin/docker-dotenv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/docker-dotenv b/bin/docker-dotenv index 1c9544d..3bc9818 100755 --- a/bin/docker-dotenv +++ b/bin/docker-dotenv @@ -3,8 +3,8 @@ # input: # SOURCE_IMAGE: Image name for the source image # TARGET_IMAGE: Name of image to build -# DOTENV: The list of env variables delimited by a ; -# e.g. DOTENV="FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;" +# DOTENV: The name of the .env.* file that contains the default env vars to export. +# e.g. DOTENV=".env.12-3-stable" set -e -- cgit v1.2.3 From f18510931631146f25e6d5c5dc010edee9ad3e3a Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:54:58 -0600 Subject: print temporary dockerfile content --- bin/docker-dotenv | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/docker-dotenv b/bin/docker-dotenv index 3bc9818..5f4b96c 100755 --- a/bin/docker-dotenv +++ b/bin/docker-dotenv @@ -19,6 +19,12 @@ while IFS= read -r line; do echo "ENV $line" >> $DOCKERFILE done < $DOTENV +echo "Pulling... $SOURCE_IMAGE" docker pull $SOURCE_IMAGE + +echo "Building... $DOCKERFILE" +cat $DOCKERFILE docker build -t $TARGET_IMAGE -f $DOCKERFILE . + +echo "Verifying env..." docker run $TARGET_IMAGE env -- cgit v1.2.3 From 7adf7419cb117a2bcf0b6274cd2ed0b8918ee6a4 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:57:39 -0600 Subject: delegate to dotenv-legacy to inject specific environment variables --- .gitlab-ci.yml | 52 ++++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ce16d4..678017b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,7 +58,7 @@ container_scanning: - ./bin/docker-inject-env - docker push $TARGET_IMAGE -.legacy-v1-variables: +.dotenv-legacy: extends: .dotenv variables: DOTENV: ".env.legacy" @@ -165,12 +165,6 @@ version python2: only: - tags -.release_python2: - extends: .docker_tag_python2 - stage: release - only: - - tags - major: extends: .release variables: @@ -186,60 +180,46 @@ latest: 12-2-stable: extends: .release - extends: .legacy-v1-variables + extends: .dotenv-legacy 12-1-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 12-0-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-11-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-10-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-9-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-8-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-7-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-6-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-5-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-4-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-3-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-2-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-1-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy 11-0-stable: - extends: .release_python2 - extends: .legacy-v1-variables + extends: .dotenv-legacy -- cgit v1.2.3 From 321fcb6ff1e208ba64a73412042dcf765a677f51 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 11:58:53 -0600 Subject: specify .env.12-3-stable --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 678017b..26d5311 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -176,7 +176,7 @@ latest: 12-3-stable: extends: .release variables: - DOTENV: ".env.legacy" + DOTENV: ".env.12-3-stable" 12-2-stable: extends: .release -- cgit v1.2.3 From 87c82558664e59a235591d1debd163c7a214694b Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 12:08:15 -0600 Subject: ensure 12-2 stable uses correct env variables --- .env.12-2-stable | 3 +++ .gitlab-ci.yml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .env.12-2-stable diff --git a/.env.12-2-stable b/.env.12-2-stable new file mode 100644 index 0000000..3e94bc7 --- /dev/null +++ b/.env.12-2-stable @@ -0,0 +1,3 @@ +FEATURE_RUBY_REPORT 'false' +LM_REPORT_VERSION 1 +LM_V1_CANONICALIZE 'false' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26d5311..d685161 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -180,7 +180,8 @@ latest: 12-2-stable: extends: .release - extends: .dotenv-legacy + variables: + DOTENV: ".env.12-2-stable" 12-1-stable: extends: .dotenv-legacy -- cgit v1.2.3 From ce94ec61bd99a01c640ae4ece855fd77e289487c Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 12:11:51 -0600 Subject: ensure dotenv defaults to release stages for tags only --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d685161..bb8bea7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,6 +50,10 @@ container_scanning: when: always .dotenv: + image: docker:stable + stage: release + only: + - tags script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY -- cgit v1.2.3 From 72f8f3f8e1e09ead3023c1e81449200d16616f3a Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 12:23:19 -0600 Subject: add missing v --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adcc0a9..38cf864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # GitLab License management changelog -## 1.7.0 +## v1.7.0 - Convert HTML to JSON transformation to generating a JSON report directly. -- cgit v1.2.3 From f9f78d84f50d5ceccba26d333ef0b36ceb7f94e3 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 13:57:38 -0600 Subject: inline .dotenv and .dotenv-legacy jobs --- .gitlab-ci.yml | 81 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb8bea7..b4c7203 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,24 +49,6 @@ container_scanning: - results/ when: always -.dotenv: - image: docker:stable - stage: release - only: - - tags - script: - - docker info - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - export SOURCE_IMAGE=$TMP_IMAGE - - export TARGET_IMAGE=$CI_REGISTRY_IMAGE:${IMAGE_TAG:-$CI_JOB_NAME} - - ./bin/docker-inject-env - - docker push $TARGET_IMAGE - -.dotenv-legacy: - extends: .dotenv - variables: - DOTENV: ".env.legacy" - QA:java-maven: extends: .QA variables: @@ -108,7 +90,12 @@ QA:go: - export SOURCE_IMAGE=$TMP_IMAGE - export TARGET_IMAGE=$CI_REGISTRY_IMAGE:${IMAGE_TAG:-$CI_JOB_NAME} - docker pull $SOURCE_IMAGE - - docker tag $SOURCE_IMAGE $TARGET_IMAGE + - | + if [ -z "$DOTENV" ]; then + docker tag $SOURCE_IMAGE $TARGET_IMAGE + else + ./bin/docker-dotenv + fi - docker push $TARGET_IMAGE .docker_tag_python2: @@ -188,43 +175,71 @@ latest: DOTENV: ".env.12-2-stable" 12-1-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 12-0-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-11-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-10-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-9-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-8-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-7-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-6-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-5-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-4-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-3-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-2-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-1-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" 11-0-stable: - extends: .dotenv-legacy + extends: .release + variables: + DOTENV: ".env.legacy" -- cgit v1.2.3 From 4ec3d97df392ca472e7e674b2699c756eb7cbf64 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 14:10:25 -0600 Subject: add test job to generate testable release version. --- .gitlab-ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4c7203..dfe57a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,6 +49,17 @@ container_scanning: - results/ when: always +QA:test-release: + extends: .release + variables: + DOTENV: '.env.legacy' + IMAGE_TAG: 12-test-release-stable + only: + - branches + except: + - master + when: manual + QA:java-maven: extends: .QA variables: -- cgit v1.2.3 From 5e87e4ebaef6edd8ae7250a71dead5f5b2a1a506 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 14:57:30 -0600 Subject: override the entrypoint --- bin/docker-dotenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/docker-dotenv b/bin/docker-dotenv index 5f4b96c..bfe1369 100755 --- a/bin/docker-dotenv +++ b/bin/docker-dotenv @@ -27,4 +27,4 @@ cat $DOCKERFILE docker build -t $TARGET_IMAGE -f $DOCKERFILE . echo "Verifying env..." -docker run $TARGET_IMAGE env +docker run --entrypoint='' $TARGET_IMAGE env -- cgit v1.2.3 From 1b01671a20247cffe6074b5e037af12427a0633b Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 15:28:30 -0600 Subject: try using MARJOR and CI_COMMIT_REF_SLUG --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfe57a6..8142845 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,7 +53,7 @@ QA:test-release: extends: .release variables: DOTENV: '.env.legacy' - IMAGE_TAG: 12-test-release-stable + IMAGE_TAG: "${MAJOR}-${CI_COMMIT_REF_SLUG}-stable" only: - branches except: -- cgit v1.2.3 From 922390fd60c026c478d70690c6ee204bcc14bca2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 15:29:50 -0600 Subject: dump dotenv file before building custom Dockerfile --- bin/docker-dotenv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/docker-dotenv b/bin/docker-dotenv index bfe1369..ab2c6c6 100755 --- a/bin/docker-dotenv +++ b/bin/docker-dotenv @@ -15,6 +15,9 @@ rm -f $DOCKERFILE touch $DOCKERFILE echo "FROM $SOURCE_IMAGE" > $DOCKERFILE +echo "Reading... $DOTENV" +cat $DOTENV + while IFS= read -r line; do echo "ENV $line" >> $DOCKERFILE done < $DOTENV -- cgit v1.2.3 From e32312585b81465d596b3ced689686121a9062c6 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 16:15:47 -0600 Subject: add manual jobs for creating a 12-* test images --- .gitlab-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8142845..2cf7ef6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,6 +60,21 @@ QA:test-release: - master when: manual +QA:test-release-12-3: + extends: QA:test-release + variables: + DOTENV: ".env.12-3-stable" + +QA:test-release-12-2: + extends: QA:test-release + variables: + DOTENV: ".env.12-2-stable" + +QA:test-release-12-1: + extends: QA:test-release + variables: + DOTENV: ".env.legacy" + QA:java-maven: extends: .QA variables: -- cgit v1.2.3 From 84cced338714c3eea91e3208c7dda82853efe400 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 16:18:34 -0600 Subject: override IMAGE_TAG for test release jobs --- .gitlab-ci.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2cf7ef6..3ad640a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,7 +49,7 @@ container_scanning: - results/ when: always -QA:test-release: +.QA:test-release: extends: .release variables: DOTENV: '.env.legacy' @@ -60,20 +60,23 @@ QA:test-release: - master when: manual -QA:test-release-12-3: - extends: QA:test-release +12-3-test-release: + extends: .QA:test-release variables: DOTENV: ".env.12-3-stable" + IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_REF_SLUG}-stable" -QA:test-release-12-2: - extends: QA:test-release +12-2-test-release: + extends: .QA:test-release variables: DOTENV: ".env.12-2-stable" + IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" -QA:test-release-12-1: - extends: QA:test-release +12-1-test-release: + extends: .QA:test-release variables: DOTENV: ".env.legacy" + IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_REF_SLUG}-stable" QA:java-maven: extends: .QA -- cgit v1.2.3 From 55d92af0a3207a89c328ae53aee50254ae49795f Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 16:48:01 -0600 Subject: print TARGET_IMAGE --- bin/docker-dotenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/docker-dotenv b/bin/docker-dotenv index ab2c6c6..ca025c0 100755 --- a/bin/docker-dotenv +++ b/bin/docker-dotenv @@ -25,7 +25,7 @@ done < $DOTENV echo "Pulling... $SOURCE_IMAGE" docker pull $SOURCE_IMAGE -echo "Building... $DOCKERFILE" +echo "Building... $DOCKERFILE and tagging $TARGET_IMAGE" cat $DOCKERFILE docker build -t $TARGET_IMAGE -f $DOCKERFILE . -- cgit v1.2.3 From 1ae76901433b2fa92270126691b0f7c0db4e151a Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 16:52:12 -0600 Subject: test to see if before_script will export the proper env var --- .gitlab-ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ad640a..50b625c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,18 +62,23 @@ container_scanning: 12-3-test-release: extends: .QA:test-release + before_script: + - export IMAGE_TAG="${MAJOR}-3_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.12-3-stable" IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_REF_SLUG}-stable" 12-2-test-release: extends: .QA:test-release + before_script: + - export IMAGE_TAG="${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.12-2-stable" - IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" 12-1-test-release: extends: .QA:test-release + before_script: + - export IMAGE_TAG="${MAJOR}-1_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.legacy" IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_REF_SLUG}-stable" @@ -118,9 +123,9 @@ QA:go: - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - export SOURCE_IMAGE=$TMP_IMAGE - export TARGET_IMAGE=$CI_REGISTRY_IMAGE:${IMAGE_TAG:-$CI_JOB_NAME} - - docker pull $SOURCE_IMAGE - | if [ -z "$DOTENV" ]; then + docker pull $SOURCE_IMAGE docker tag $SOURCE_IMAGE $TARGET_IMAGE else ./bin/docker-dotenv -- cgit v1.2.3 From 17925120921f7f1c08409747038bebbae954680f Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 16:55:17 -0600 Subject: move test release jobs to test stage --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50b625c..4e48abb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,7 @@ container_scanning: .QA:test-release: extends: .release + stage: test variables: DOTENV: '.env.legacy' IMAGE_TAG: "${MAJOR}-${CI_COMMIT_REF_SLUG}-stable" -- cgit v1.2.3 From 4e0df3ca8309cde85b99da1c2c81c31bbf88d1aa Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 17:37:01 -0600 Subject: bring back IMAGE_TAG --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e48abb..9b0843c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,6 +75,7 @@ container_scanning: - export IMAGE_TAG="${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.12-2-stable" + IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" 12-1-test-release: extends: .QA:test-release -- cgit v1.2.3 From 81892a844a085318cce9a138f87c08f39197869f Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 17:41:29 -0600 Subject: remove before_script because it did not work --- .gitlab-ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b0843c..020c4c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,24 +63,18 @@ container_scanning: 12-3-test-release: extends: .QA:test-release - before_script: - - export IMAGE_TAG="${MAJOR}-3_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.12-3-stable" IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_REF_SLUG}-stable" 12-2-test-release: extends: .QA:test-release - before_script: - - export IMAGE_TAG="${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.12-2-stable" IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" 12-1-test-release: extends: .QA:test-release - before_script: - - export IMAGE_TAG="${MAJOR}-1_${CI_COMMIT_REF_SLUG}-stable" variables: DOTENV: ".env.legacy" IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_REF_SLUG}-stable" -- cgit v1.2.3 From 48ae3ea11b93dfd028920e0615f1287389203d38 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 17:43:40 -0600 Subject: debug docker_tag --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 020c4c2..d17c8c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,7 +50,7 @@ container_scanning: when: always .QA:test-release: - extends: .release + extends: .docker_tag stage: test variables: DOTENV: '.env.legacy' @@ -118,7 +118,10 @@ QA:go: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - export SOURCE_IMAGE=$TMP_IMAGE + - echo $IMAGE_TAG + - echo $CI_JOB_NAME - export TARGET_IMAGE=$CI_REGISTRY_IMAGE:${IMAGE_TAG:-$CI_JOB_NAME} + - echo $TARGET_IMAGE - | if [ -z "$DOTENV" ]; then docker pull $SOURCE_IMAGE -- cgit v1.2.3 From c86eff31aea8315f437b15ffbfff513c12760c28 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 22 Aug 2019 17:55:49 -0600 Subject: enable tracing --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d17c8c0..7ce4cd4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ variables: DOCKER_DRIVER: overlay2 MAJOR: 1 TMP_IMAGE: $CI_REGISTRY_IMAGE/tmp:$CI_COMMIT_SHA + CI_DEBUG_TRACE: "true" include: - template: Container-Scanning.gitlab-ci.yml -- cgit v1.2.3 From 6c2fcaa1def6f77611db3a0859208ed3aaf98883 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 23 Aug 2019 10:31:54 -0600 Subject: use CI_COMMIT_SHA instead of the CI_COMMIT_REF_SLUG --- .gitlab-ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7ce4cd4..5fc013b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,7 +55,7 @@ container_scanning: stage: test variables: DOTENV: '.env.legacy' - IMAGE_TAG: "${MAJOR}-${CI_COMMIT_REF_SLUG}-stable" + IMAGE_TAG: "${MAJOR}-${CI_COMMIT_SHA}-stable" only: - branches except: @@ -66,19 +66,19 @@ container_scanning: extends: .QA:test-release variables: DOTENV: ".env.12-3-stable" - IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_REF_SLUG}-stable" + IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_SHA}-stable" 12-2-test-release: extends: .QA:test-release variables: DOTENV: ".env.12-2-stable" - IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_REF_SLUG}-stable" + IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_SHA}-stable" 12-1-test-release: extends: .QA:test-release variables: DOTENV: ".env.legacy" - IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_REF_SLUG}-stable" + IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_SHA}-stable" QA:java-maven: extends: .QA @@ -119,10 +119,7 @@ QA:go: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - export SOURCE_IMAGE=$TMP_IMAGE - - echo $IMAGE_TAG - - echo $CI_JOB_NAME - export TARGET_IMAGE=$CI_REGISTRY_IMAGE:${IMAGE_TAG:-$CI_JOB_NAME} - - echo $TARGET_IMAGE - | if [ -z "$DOTENV" ]; then docker pull $SOURCE_IMAGE -- cgit v1.2.3 From 0d2e9e06363c7ac3fb730e153662804d5b4d6d0d Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 23 Aug 2019 10:49:23 -0600 Subject: use the SHORT_SHA instead of the full SHA --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fc013b..fb9ed7a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,7 +55,7 @@ container_scanning: stage: test variables: DOTENV: '.env.legacy' - IMAGE_TAG: "${MAJOR}-${CI_COMMIT_SHA}-stable" + IMAGE_TAG: "${MAJOR}-${CI_COMMIT_SHORT_SHA}-stable" only: - branches except: @@ -66,19 +66,19 @@ container_scanning: extends: .QA:test-release variables: DOTENV: ".env.12-3-stable" - IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_SHA}-stable" + IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_SHORT_SHA}-stable" 12-2-test-release: extends: .QA:test-release variables: DOTENV: ".env.12-2-stable" - IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_SHA}-stable" + IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_SHORT_SHA}-stable" 12-1-test-release: extends: .QA:test-release variables: DOTENV: ".env.legacy" - IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_SHA}-stable" + IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_SHORT_SHA}-stable" QA:java-maven: extends: .QA -- cgit v1.2.3 From 414ca87abf584c0af59bc9d8ece731424fdd4402 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 23 Aug 2019 11:04:58 -0600 Subject: remove CI_DEBUG_TRACE --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb9ed7a..6308d31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,6 @@ variables: DOCKER_DRIVER: overlay2 MAJOR: 1 TMP_IMAGE: $CI_REGISTRY_IMAGE/tmp:$CI_COMMIT_SHA - CI_DEBUG_TRACE: "true" include: - template: Container-Scanning.gitlab-ci.yml -- cgit v1.2.3 From b24fbeedb5c1357ea354f19bb21eec7fe36229d9 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 23 Aug 2019 11:33:53 -0600 Subject: MAJOR does not match gitlab self managed major version --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6308d31..29ca583 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,7 +54,7 @@ container_scanning: stage: test variables: DOTENV: '.env.legacy' - IMAGE_TAG: "${MAJOR}-${CI_COMMIT_SHORT_SHA}-stable" + IMAGE_TAG: "12-${CI_COMMIT_SHORT_SHA}-stable" only: - branches except: @@ -65,19 +65,19 @@ container_scanning: extends: .QA:test-release variables: DOTENV: ".env.12-3-stable" - IMAGE_TAG: "${MAJOR}-3_${CI_COMMIT_SHORT_SHA}-stable" + IMAGE_TAG: "12-3_${CI_COMMIT_SHORT_SHA}-stable" 12-2-test-release: extends: .QA:test-release variables: DOTENV: ".env.12-2-stable" - IMAGE_TAG: "${MAJOR}-2_${CI_COMMIT_SHORT_SHA}-stable" + IMAGE_TAG: "12-2_${CI_COMMIT_SHORT_SHA}-stable" 12-1-test-release: extends: .QA:test-release variables: DOTENV: ".env.legacy" - IMAGE_TAG: "${MAJOR}-1_${CI_COMMIT_SHORT_SHA}-stable" + IMAGE_TAG: "12-1_${CI_COMMIT_SHORT_SHA}-stable" QA:java-maven: extends: .QA -- cgit v1.2.3 From 7bd94b66e1aa2cae59d587847c501e007a0c50af Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 26 Aug 2019 12:57:04 -0600 Subject: remove test jobs --- .gitlab-ci.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 29ca583..e157f53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,36 +49,6 @@ container_scanning: - results/ when: always -.QA:test-release: - extends: .docker_tag - stage: test - variables: - DOTENV: '.env.legacy' - IMAGE_TAG: "12-${CI_COMMIT_SHORT_SHA}-stable" - only: - - branches - except: - - master - when: manual - -12-3-test-release: - extends: .QA:test-release - variables: - DOTENV: ".env.12-3-stable" - IMAGE_TAG: "12-3_${CI_COMMIT_SHORT_SHA}-stable" - -12-2-test-release: - extends: .QA:test-release - variables: - DOTENV: ".env.12-2-stable" - IMAGE_TAG: "12-2_${CI_COMMIT_SHORT_SHA}-stable" - -12-1-test-release: - extends: .QA:test-release - variables: - DOTENV: ".env.legacy" - IMAGE_TAG: "12-1_${CI_COMMIT_SHORT_SHA}-stable" - QA:java-maven: extends: .QA variables: -- cgit v1.2.3