Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sources.rb « sbom « reports « ci « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a82dac1d7e21e883909e5c309ad98d082a892aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# frozen_string_literal: true

FactoryBot.define do
  factory :ci_reports_sbom_source, class: '::Gitlab::Ci::Reports::Sbom::Source' do
    dependency_scanning

    trait :dependency_scanning do
      type { :dependency_scanning }

      transient do
        sequence(:input_file_path) { |n| "subproject-#{n}/package-lock.json" }
        sequence(:source_file_path) { |n| "subproject-#{n}/package.json" }
      end

      data do
        {
          'category' => 'development',
          'input_file' => { 'path' => input_file_path },
          'source_file' => { 'path' => source_file_path },
          'package_manager' => { 'name' => 'npm' },
          'language' => { 'name' => 'JavaScript' }
        }
      end
    end

    trait :container_scanning do
      type { :container_scanning }

      transient do
        image_name { 'photon' }
        sequence(:image_tag) { |n| "5.#{n}-12345678" }
        operating_system_name { 'Photon OS' }
        sequence(:operating_system_version) { |n| "5.#{n}" }
      end

      data do
        {
          'category' => 'development',
          'image' => {
            'name' => image_name,
            'tag' => image_tag
          },
          'operating_system' => {
            'name' => operating_system_name,
            'version' => operating_system_version
          }
        }
      end
    end

    skip_create

    initialize_with do
      ::Gitlab::Ci::Reports::Sbom::Source.new(
        type: type,
        data: data
      )
    end
  end
end