Class: Gitlab::Ci::Parsers::Sbom::Cyclonedx

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/parsers/sbom/cyclonedx.rb

Constant Summary collapse

SUPPORTED_SPEC_VERSIONS =
%w[1.4].freeze

Instance Method Summary collapse

Instance Method Details

#parse!(blob, sbom_report) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/ci/parsers/sbom/cyclonedx.rb', line 10

def parse!(blob, sbom_report)
  @report = sbom_report
  @data = Gitlab::Json.parse(blob)

  return unless valid?

  parse_report
rescue JSON::ParserError => e
  report.add_error("Report JSON is invalid: #{e}")
end