2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :ci_job_artifact, class: 'Ci::JobArtifact' do
|
2017-09-21 04:34:12 -04:00
|
|
|
job factory: :ci_build
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :archive }
|
|
|
|
file_format { :zip }
|
2017-09-21 04:34:12 -04:00
|
|
|
|
2019-08-24 17:16:44 -04:00
|
|
|
trait :expired do
|
|
|
|
expire_at { Date.yesterday }
|
|
|
|
end
|
|
|
|
|
2017-12-05 09:31:33 -05:00
|
|
|
trait :remote_store do
|
2020-04-15 14:09:36 -04:00
|
|
|
file_store { JobArtifactUploader::Store::REMOTE}
|
2017-12-05 09:31:33 -05:00
|
|
|
end
|
|
|
|
|
2017-11-02 07:16:50 -04:00
|
|
|
after :build do |artifact|
|
|
|
|
artifact.project ||= artifact.job.project
|
|
|
|
end
|
|
|
|
|
2018-09-27 17:15:08 -04:00
|
|
|
trait :raw do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_format { :raw }
|
2018-09-27 17:15:08 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/trace/sample_trace'), 'text/plain')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :zip do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_format { :zip }
|
2018-09-27 17:15:08 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :gzip do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_format { :gzip }
|
2018-09-27 17:15:08 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-11-23 12:51:20 -05:00
|
|
|
trait :archive do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :archive }
|
|
|
|
file_format { :zip }
|
2017-11-30 12:32:16 -05:00
|
|
|
|
2019-03-22 08:38:45 -04:00
|
|
|
transient do
|
|
|
|
file { fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip') }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = evaluator.file
|
2017-09-21 04:34:12 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-08-17 00:33:15 -04:00
|
|
|
trait :legacy_archive do
|
|
|
|
archive
|
|
|
|
|
2019-10-01 20:06:26 -04:00
|
|
|
file_location { :legacy_path }
|
2018-08-17 00:33:15 -04:00
|
|
|
end
|
|
|
|
|
2017-11-23 12:51:20 -05:00
|
|
|
trait :metadata do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :metadata }
|
|
|
|
file_format { :gzip }
|
2017-11-30 12:32:16 -05:00
|
|
|
|
2019-03-22 08:38:45 -04:00
|
|
|
transient do
|
|
|
|
file { fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip') }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = evaluator.file
|
2017-11-23 12:51:20 -05:00
|
|
|
end
|
2017-09-21 04:34:12 -04:00
|
|
|
end
|
2018-02-06 09:18:32 -05:00
|
|
|
|
|
|
|
trait :trace do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :trace }
|
|
|
|
file_format { :raw }
|
2018-02-06 09:18:32 -05:00
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/trace/sample_trace'), 'text/plain')
|
|
|
|
end
|
|
|
|
end
|
2018-03-06 13:46:36 -05:00
|
|
|
|
2018-07-27 01:04:35 -04:00
|
|
|
trait :junit do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
2018-07-27 01:04:35 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
2018-08-02 04:15:25 -04:00
|
|
|
Rails.root.join('spec/fixtures/junit/junit.xml.gz'), 'application/x-gzip')
|
2018-07-27 01:04:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-03 02:09:14 -04:00
|
|
|
trait :junit_with_attachment do
|
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/junit/junit_with_attachment.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-23 14:08:31 -04:00
|
|
|
trait :junit_with_duplicate_failed_test_names do
|
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/junit/junit_with_duplicate_failed_test_names.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-08-02 02:05:07 -04:00
|
|
|
trait :junit_with_ant do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
2018-08-02 02:05:07 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
2018-08-02 04:15:25 -04:00
|
|
|
Rails.root.join('spec/fixtures/junit/junit_ant.xml.gz'), 'application/x-gzip')
|
2018-08-02 02:05:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :junit_with_three_testsuites do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
2018-08-02 02:05:07 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/junit/junit_with_three_testsuites.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :junit_with_corrupted_data do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
2018-08-02 02:05:07 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/junit/junit_with_corrupted_data.xml.gz'), 'application/x-gzip')
|
2020-03-17 14:09:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-02 04:08:35 -05:00
|
|
|
trait :junit_with_three_failures do
|
|
|
|
file_type { :junit }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/junit/junit_with_three_failures.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-22 23:09:51 -04:00
|
|
|
trait :accessibility do
|
|
|
|
file_type { :accessibility }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/accessibility/pa11y_with_errors.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :accessibility_with_invalid_url do
|
|
|
|
file_type { :accessibility }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/accessibility/pa11y_with_invalid_url.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :accessibility_without_errors do
|
|
|
|
file_type { :accessibility }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/accessibility/pa11y_without_errors.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-17 14:09:44 -04:00
|
|
|
trait :cobertura do
|
|
|
|
file_type { :cobertura }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/cobertura/coverage.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
trait :terraform do
|
|
|
|
file_type { :terraform }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/terraform/tfplan.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :terraform_with_corrupted_data do
|
|
|
|
file_type { :terraform }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/terraform/tfplan_with_corrupted_data.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-17 14:09:44 -04:00
|
|
|
trait :coverage_gocov_xml do
|
|
|
|
file_type { :cobertura }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/cobertura/coverage_gocov_xml.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
2020-12-04 10:09:36 -05:00
|
|
|
|
|
|
|
trait :coverage_with_paths_not_relative_to_project_root do
|
|
|
|
file_type { :cobertura }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/cobertura/coverage_with_paths_not_relative_to_project_root.xml.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
2020-03-17 14:09:44 -04:00
|
|
|
|
|
|
|
trait :coverage_with_corrupted_data do
|
|
|
|
file_type { :cobertura }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/cobertura/coverage_with_corrupted_data.xml.gz'), 'application/x-gzip')
|
2018-08-02 02:05:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-10-02 13:01:26 -04:00
|
|
|
trait :codequality do
|
2019-10-01 20:06:26 -04:00
|
|
|
file_type { :codequality }
|
|
|
|
file_format { :raw }
|
2018-10-02 13:01:26 -04:00
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
2020-11-23 10:09:37 -05:00
|
|
|
Rails.root.join('spec/fixtures/codequality/codeclimate.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :codequality_without_errors do
|
|
|
|
file_type { :codequality }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/codequality/codeclimate_without_errors.json'), 'application/json')
|
2018-10-02 13:01:26 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-10 04:09:38 -05:00
|
|
|
trait :sast do
|
|
|
|
file_type { :sast }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/master/gl-sast-report.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-04 20:10:41 -04:00
|
|
|
trait :sast_minimal do
|
|
|
|
file_type { :sast }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/master/gl-sast-report-minimal.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-08-02 11:08:56 -04:00
|
|
|
trait :common_security_report do
|
|
|
|
file_format { :raw }
|
|
|
|
file_type { :dependency_scanning }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/master/gl-common-scanning-report.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :common_security_report_with_blank_names do
|
|
|
|
file_format { :raw }
|
|
|
|
file_type { :dependency_scanning }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/master/gl-common-scanning-report-names.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :sast_deprecated do
|
|
|
|
file_type { :sast }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/deprecated/gl-sast-report.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :sast_with_corrupted_data do
|
|
|
|
file_type { :sast }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/trace/sample_trace'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :sast_feature_branch do
|
|
|
|
file_format { :raw }
|
|
|
|
file_type { :sast }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/feature-branch/gl-sast-report.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :secret_detection_feature_branch do
|
|
|
|
file_format { :raw }
|
|
|
|
file_type { :secret_detection }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/feature-branch/gl-secret-detection-report.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :sast_with_missing_scanner do
|
|
|
|
file_type { :sast }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/master/gl-sast-missing-scanner.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-10 04:09:38 -05:00
|
|
|
trait :secret_detection do
|
|
|
|
file_type { :secret_detection }
|
|
|
|
file_format { :raw }
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/security_reports/master/gl-secret-detection-report.json'), 'application/json')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-02-10 10:08:54 -05:00
|
|
|
trait :lsif do
|
|
|
|
file_type { :lsif }
|
2020-05-15 14:07:52 -04:00
|
|
|
file_format { :zip }
|
|
|
|
|
2020-02-10 10:08:54 -05:00
|
|
|
after(:build) do |artifact, evaluator|
|
2020-05-27 02:08:13 -04:00
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/lsif.json.zip'), 'application/zip')
|
2020-02-10 10:08:54 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-13 17:09:38 -04:00
|
|
|
trait :dotenv do
|
|
|
|
file_type { :dotenv }
|
|
|
|
file_format { :gzip }
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/build.env.gz'), 'application/x-gzip')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-06 13:46:36 -05:00
|
|
|
trait :correct_checksum do
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file_sha256 = Digest::SHA256.file(artifact.file.path).hexdigest
|
|
|
|
end
|
|
|
|
end
|
2017-09-21 04:34:12 -04:00
|
|
|
end
|
|
|
|
end
|