Commit 56e516a5 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '8911-fix-license-comliance-with-new-artifact' into 'master'

Empty Licenses list and new artifact name

See merge request gitlab-org/gitlab!23267
parents 6ec84d45 76d40559
...@@ -24,7 +24,7 @@ module EE ...@@ -24,7 +24,7 @@ module EE
after_save :stick_build_if_status_changed after_save :stick_build_if_status_changed
delegate :service_specification, to: :runner_session, allow_nil: true delegate :service_specification, to: :runner_session, allow_nil: true
scope :license_scan, -> { joins(:job_artifacts).merge(::Ci::JobArtifact.license_management) } scope :license_scan, -> { joins(:job_artifacts).merge(::Ci::JobArtifact.license_scanning_reports) }
scope :max_build_id_by, -> (build_name, ref, project_path) do scope :max_build_id_by, -> (build_name, ref, project_path) do
select('max(ci_builds.id) as id') select('max(ci_builds.id) as id')
.by_name(build_name) .by_name(build_name)
......
...@@ -120,7 +120,7 @@ FactoryBot.define do ...@@ -120,7 +120,7 @@ FactoryBot.define do
after(:build) do |artifact, _| after(:build) do |artifact, _|
artifact.file = fixture_file_upload( artifact.file = fixture_file_upload(
Rails.root.join('ee/spec/fixtures/security_reports/master/gl-license-management-report.json'), 'application/json') Rails.root.join('ee/spec/fixtures/security_reports/deprecated/gl-license-management-report.json'), 'application/json')
end end
end end
...@@ -130,7 +130,7 @@ FactoryBot.define do ...@@ -130,7 +130,7 @@ FactoryBot.define do
after(:build) do |artifact, _| after(:build) do |artifact, _|
artifact.file = fixture_file_upload( artifact.file = fixture_file_upload(
Rails.root.join('ee/spec/fixtures/security_reports/master/gl-license-management-report.json'), 'application/json') Rails.root.join('ee/spec/fixtures/security_reports/master/gl-license-scanning-report.json'), 'application/json')
end end
end end
......
{
"licenses": [
{
"count": 52,
"name": "MIT"
},
{
"count": 3,
"name": "New BSD"
},
{
"count": 1,
"name": "Apache 2.0"
},
{
"count": 1,
"name": "unknown"
}
],
"dependencies": [
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "actioncable",
"url": "http://rubyonrails.org",
"description": "WebSocket framework for Rails.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "actionmailer",
"url": "http://rubyonrails.org",
"description": "Email composition, delivery, and receiving framework (part of Rails).",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "actionpack",
"url": "http://rubyonrails.org",
"description": "Web-flow and rendering framework putting the VC in MVC (part of Rails).",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "actionview",
"url": "http://rubyonrails.org",
"description": "Rendering framework putting the V in MVC (part of Rails).",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "activejob",
"url": "http://rubyonrails.org",
"description": "Job framework with pluggable queues.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "activemodel",
"url": "http://rubyonrails.org",
"description": "A toolkit for building modeling frameworks (part of Rails).",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "activerecord",
"url": "http://rubyonrails.org",
"description": "Object-relational mapper framework (part of Rails).",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "activesupport",
"url": "http://rubyonrails.org",
"description": "A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "arel",
"url": "https://github.com/rails/arel",
"description": "Arel Really Exasperates Logicians Arel is a SQL AST manager for Ruby",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "builder",
"url": "http://onestepback.org",
"description": "Builders for MarkUp.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "bundler",
"url": "http://bundler.io",
"description": "The best way to manage your application's dependencies",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "coffee-rails",
"url": "https://github.com/rails/coffee-rails",
"description": "CoffeeScript adapter for the Rails asset pipeline.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "coffee-script",
"url": "http://github.com/josh/ruby-coffee-script",
"description": "Ruby CoffeeScript Compiler",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "coffee-script-source",
"url": "http://coffeescript.org",
"description": "The CoffeeScript Compiler",
"paths": [
"."
]
}
},
{
"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.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "crass",
"url": "https://github.com/rgrove/crass/",
"description": "CSS parser based on the CSS Syntax Level 3 spec.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "erubis",
"url": "http://www.kuwata-lab.com/erubis/",
"description": "a fast and extensible eRuby implementation which supports multi-language",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "execjs",
"url": "https://github.com/rails/execjs",
"description": "Run JavaScript code from Ruby",
"paths": [
"."
]
}
},
{
"license": {
"name": "New BSD",
"url": "http://opensource.org/licenses/BSD-3-Clause"
},
"dependency": {
"name": "ffi",
"url": "http://wiki.github.com/ffi/ffi",
"description": "Ruby FFI",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "globalid",
"url": "http://www.rubyonrails.org",
"description": "Refer to any model with a URI: gid://app/class/id",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "i18n",
"url": "http://github.com/svenfuchs/i18n",
"description": "New wave Internationalization support for Ruby",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "jbuilder",
"url": "https://github.com/rails/jbuilder",
"description": "Create JSON structures via a Builder-style DSL",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "loofah",
"description": "",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "mail",
"url": "https://github.com/mikel/mail",
"description": "Mail provides a nice Ruby DSL for making, sending and reading emails.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "method_source",
"url": "http://banisterfiend.wordpress.com",
"description": "retrieve the sourcecode for a method",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "mini_mime",
"url": "https://github.com/discourse/mini_mime",
"description": "A lightweight mime type lookup toy",
"paths": [
"."
]
}
},
{
"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",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "minitest",
"url": "https://github.com/seattlerb/minitest",
"description": "minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "multi_json",
"url": "http://github.com/intridea/multi_json",
"description": "A common interface to multiple JSON libraries.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "nio4r",
"url": "https://github.com/celluloid/nio4r",
"description": "NIO provides a high performance selector API for monitoring IO objects",
"paths": [
"."
]
}
},
{
"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",
"paths": [
"."
]
}
},
{
"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",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rack",
"url": "https://rack.github.io/",
"description": "a modular Ruby webserver interface",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rack-test",
"url": "http://github.com/brynary/rack-test",
"description": "Simple testing API built on Rack",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rails",
"url": "http://rubyonrails.org",
"description": "Full-stack web application framework.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rails-dom-testing",
"url": "https://github.com/rails/rails-dom-testing",
"description": "Dom and Selector assertions for Rails applications",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rails-html-sanitizer",
"url": "https://github.com/rails/rails-html-sanitizer",
"description": "This gem is responsible to sanitize HTML fragments in Rails applications.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "railties",
"url": "http://rubyonrails.org",
"description": "Tools for creating, working with, and running Rails applications.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rake",
"url": "https://github.com/ruby/rake",
"description": "Rake is a Make-like program implemented in Ruby",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rb-fsevent",
"url": "http://rubygems.org/gems/rb-fsevent",
"description": "Very simple & usable FSEvents API",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "rb-inotify",
"url": "https://github.com/guard/rb-inotify",
"description": "A Ruby wrapper for Linux inotify, using FFI",
"paths": [
"."
]
}
},
{
"license": {
"name": "unknown"
},
"dependency": {
"name": "ruby-bundler-rails",
"description": "",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "sass",
"url": "http://sass-lang.com/",
"description": "A powerful but elegant CSS compiler that makes CSS fun again.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "sass-listen",
"url": "https://github.com/sass/listen",
"description": "Fork of guard/listen",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "sass-rails",
"url": "https://github.com/rails/sass-rails",
"description": "Sass adapter for the Rails asset pipeline.",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "sprockets",
"url": "https://github.com/rails/sprockets",
"description": "Rack-based asset packaging system",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "sprockets-rails",
"url": "https://github.com/rails/sprockets-rails",
"description": "Sprockets Rails integration",
"paths": [
"."
]
}
},
{
"license": {
"name": "New BSD",
"url": "http://opensource.org/licenses/BSD-3-Clause"
},
"dependency": {
"name": "sqlite3",
"url": "https://github.com/sparklemotion/sqlite3-ruby",
"description": "This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "thor",
"url": "http://whatisthor.com/",
"description": "Thor is a toolkit for building powerful command-line interfaces.",
"paths": [
"."
]
}
},
{
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.txt"
},
"dependency": {
"name": "thread_safe",
"url": "https://github.com/ruby-concurrency/thread_safe",
"description": "Thread-safe collections and utilities for Ruby",
"paths": [
"."
]
}
},
{
"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",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "turbolinks",
"url": "https://github.com/turbolinks/turbolinks",
"description": "Turbolinks makes navigating your web application faster",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "turbolinks-source",
"url": "https://github.com/turbolinks/turbolinks-source-gem",
"description": "Turbolinks JavaScript assets",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "tzinfo",
"url": "http://tzinfo.github.io",
"description": "Daylight savings aware timezone library",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "uglifier",
"url": "http://github.com/lautis/uglifier",
"description": "Ruby wrapper for UglifyJS JavaScript compressor",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "websocket-driver",
"url": "http://github.com/faye/websocket-driver-ruby",
"description": "WebSocket protocol handler with pluggable I/O",
"paths": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/mit-license"
},
"dependency": {
"name": "websocket-extensions",
"url": "https://github.com/faye/websocket-extensions-ruby",
"description": "Generic extension manager for WebSocket connections",
"paths": [
"."
]
}
}
]
}
...@@ -7,7 +7,7 @@ describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do ...@@ -7,7 +7,7 @@ describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do
let(:report) { Gitlab::Ci::Reports::LicenseScanning::Report.new } let(:report) { Gitlab::Ci::Reports::LicenseScanning::Report.new }
context 'when parsing a valid v1 report' do context 'when parsing a valid v1 report' do
let(:v1_json) { fixture_file('security_reports/master/gl-license-management-report.json', dir: 'ee') } let(:v1_json) { fixture_file('security_reports/master/gl-license-scanning-report.json', dir: 'ee') }
before do before do
subject.parse!(v1_json, report) subject.parse!(v1_json, report)
......
...@@ -270,7 +270,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -270,7 +270,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context 'when parsing a v1 report' do context 'when parsing a v1 report' do
subject { described_class.parse_from(v1_json) } subject { described_class.parse_from(v1_json) }
let(:v1_json) { fixture_file('security_reports/master/gl-license-management-report.json', dir: 'ee') } let(:v1_json) { fixture_file('security_reports/master/gl-license-scanning-report.json', dir: 'ee') }
it { expect(subject.version).to eql('1.0') } it { expect(subject.version).to eql('1.0') }
it { expect(subject.licenses.count).to eq(4) } it { expect(subject.licenses.count).to eq(4) }
......
...@@ -16,6 +16,24 @@ describe Ci::Build do ...@@ -16,6 +16,24 @@ describe Ci::Build do
let(:job) { create(:ci_build, pipeline: pipeline) } let(:job) { create(:ci_build, pipeline: pipeline) }
let(:artifact) { create(:ee_ci_job_artifact, :sast, job: job, project: job.project) } let(:artifact) { create(:ee_ci_job_artifact, :sast, job: job, project: job.project) }
describe '.license_scan' do
subject(:build) { described_class.license_scan.first }
let(:artifact) { build.job_artifacts.first }
context 'with old license_management artifact' do
let!(:license_artifact) { create(:ee_ci_job_artifact, :license_management, job: job, project: job.project) }
it { expect(artifact.file_type).to eq 'license_management' }
end
context 'with new license_scanning artifact' do
let!(:license_artifact) { create(:ee_ci_job_artifact, :license_scanning, job: job, project: job.project) }
it { expect(artifact.file_type).to eq 'license_scanning' }
end
end
describe '#shared_runners_minutes_limit_enabled?' do describe '#shared_runners_minutes_limit_enabled?' do
subject { job.shared_runners_minutes_limit_enabled? } subject { job.shared_runners_minutes_limit_enabled? }
...@@ -24,7 +42,7 @@ describe Ci::Build do ...@@ -24,7 +42,7 @@ describe Ci::Build do
job.runner = create(:ci_runner, :instance) job.runner = create(:ci_runner, :instance)
end end
it do specify do
expect(job.project).to receive(:shared_runners_minutes_limit_enabled?) expect(job.project).to receive(:shared_runners_minutes_limit_enabled?)
.and_return(true) .and_return(true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment