Class: Gitlab::Ci::Reports::Sbom::Report
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::Sbom::Report
- Defined in:
- lib/gitlab/ci/reports/sbom/report.rb
Constant Summary collapse
- BOM_FORMAT =
This represents the attributes defined in cycloneDX Schema gitlab.com/gitlab-org/gitlab/-/blob/master/app/validators/json_schemas/cyclonedx_report.json#L7
'CycloneDX'
- SPEC_VERSION =
'1.4'
- VERSION =
1
Instance Attribute Summary collapse
-
#components ⇒ Object
Returns the value of attribute components.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#sbom_attributes ⇒ Object
Returns the value of attribute sbom_attributes.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #add_component(component) ⇒ Object
- #add_error(error) ⇒ Object
-
#initialize ⇒ Report
constructor
A new instance of Report.
- #set_source(source) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 17 def initialize @sbom_attributes = { bom_format: BOM_FORMAT, spec_version: SPEC_VERSION, serial_number: "urn:uuid:#{SecureRandom.uuid}", version: VERSION } @components = [] @metadata = ::Gitlab::Ci::Reports::Sbom::Metadata.new @errors = [] end |
Instance Attribute Details
#components ⇒ Object
Returns the value of attribute components.
15 16 17 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 15 def components @components end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
14 15 16 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 14 def errors @errors end |
#metadata ⇒ Object
Returns the value of attribute metadata.
15 16 17 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 15 def @metadata end |
#sbom_attributes ⇒ Object
Returns the value of attribute sbom_attributes.
15 16 17 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 15 def sbom_attributes @sbom_attributes end |
#source ⇒ Object
Returns the value of attribute source.
14 15 16 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 14 def source @source end |
Instance Method Details
#add_component(component) ⇒ Object
41 42 43 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 41 def add_component(component) components << component end |
#add_error(error) ⇒ Object
33 34 35 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 33 def add_error(error) errors << error end |
#set_source(source) ⇒ Object
37 38 39 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 37 def set_source(source) self.source = source end |
#valid? ⇒ Boolean
29 30 31 |
# File 'lib/gitlab/ci/reports/sbom/report.rb', line 29 def valid? errors.empty? end |