2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2021-02-05 04:09:10 -05:00
|
|
|
factory :ci_build, class: 'Ci::Build', parent: :ci_processable do
|
2019-10-01 20:06:26 -04:00
|
|
|
name { 'test' }
|
|
|
|
add_attribute(:protected) { false }
|
|
|
|
created_at { 'Di 29. Okt 09:50:00 CET 2013' }
|
2017-12-21 10:49:15 -05:00
|
|
|
pending
|
2016-12-12 08:53:05 -05:00
|
|
|
|
2015-08-25 21:42:46 -04:00
|
|
|
options do
|
|
|
|
{
|
2020-03-25 08:08:19 -04:00
|
|
|
image: 'ruby:2.7',
|
2018-09-02 10:35:15 -04:00
|
|
|
services: ['postgres'],
|
|
|
|
script: ['ls -a']
|
2015-08-25 21:42:46 -04:00
|
|
|
}
|
|
|
|
end
|
2016-12-12 08:53:05 -05:00
|
|
|
|
2016-07-16 14:10:22 -04:00
|
|
|
yaml_variables do
|
|
|
|
[
|
2016-12-14 09:38:40 -05:00
|
|
|
{ key: 'DB_NAME', value: 'postgres', public: true }
|
2016-07-16 14:10:22 -04:00
|
|
|
]
|
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2020-04-03 14:10:03 -04:00
|
|
|
project { pipeline.project }
|
2015-09-15 14:51:03 -04:00
|
|
|
|
2018-10-23 06:58:41 -04:00
|
|
|
trait :degenerated do
|
2019-10-01 20:06:26 -04:00
|
|
|
options { nil }
|
|
|
|
yaml_variables { nil }
|
2018-10-23 06:58:41 -04:00
|
|
|
end
|
|
|
|
|
2021-03-23 05:09:17 -04:00
|
|
|
trait :unique_name do
|
|
|
|
name { generate(:job_name) }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :dependent do
|
|
|
|
transient do
|
|
|
|
sequence(:needed_name) { |n| "dependency #{n}" }
|
|
|
|
needed { association(:ci_build, name: needed_name, pipeline: pipeline) }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |build, evaluator|
|
|
|
|
build.needs << create(:ci_build_need, build: build, name: evaluator.needed.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-12-21 10:49:15 -05:00
|
|
|
trait :started do
|
2019-10-01 20:06:26 -04:00
|
|
|
started_at { 'Di 29. Okt 09:51:28 CET 2013' }
|
2017-12-21 10:49:15 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :finished do
|
|
|
|
started
|
2019-10-01 20:06:26 -04:00
|
|
|
finished_at { 'Di 29. Okt 09:53:28 CET 2013' }
|
2017-12-21 10:49:15 -05:00
|
|
|
end
|
|
|
|
|
2016-02-18 04:52:57 -05:00
|
|
|
trait :success do
|
2017-12-21 10:49:15 -05:00
|
|
|
finished
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'success' }
|
2016-02-18 04:52:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :failed do
|
2017-12-21 10:49:15 -05:00
|
|
|
finished
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'failed' }
|
2016-02-18 04:52:57 -05:00
|
|
|
end
|
|
|
|
|
2016-01-13 10:05:49 -05:00
|
|
|
trait :canceled do
|
2017-12-21 10:49:15 -05:00
|
|
|
finished
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'canceled' }
|
2016-01-13 10:05:49 -05:00
|
|
|
end
|
|
|
|
|
2016-11-18 12:02:49 -05:00
|
|
|
trait :skipped do
|
2017-12-21 10:49:15 -05:00
|
|
|
started
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'skipped' }
|
2016-11-18 12:02:49 -05:00
|
|
|
end
|
|
|
|
|
2016-02-18 05:47:35 -05:00
|
|
|
trait :running do
|
2017-12-21 10:49:15 -05:00
|
|
|
started
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'running' }
|
2016-02-18 05:47:35 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :pending do
|
2019-10-01 20:06:26 -04:00
|
|
|
queued_at { 'Di 29. Okt 09:50:59 CET 2013' }
|
2021-06-08 05:09:56 -04:00
|
|
|
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'pending' }
|
2016-02-18 05:47:35 -05:00
|
|
|
end
|
|
|
|
|
2016-08-11 09:22:35 -04:00
|
|
|
trait :created do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'created' }
|
2016-08-11 09:22:35 -04:00
|
|
|
end
|
|
|
|
|
2019-02-26 21:13:06 -05:00
|
|
|
trait :preparing do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'preparing' }
|
2019-02-26 21:13:06 -05:00
|
|
|
end
|
|
|
|
|
2018-09-26 06:12:48 -04:00
|
|
|
trait :scheduled do
|
|
|
|
schedulable
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'scheduled' }
|
2019-01-16 07:09:29 -05:00
|
|
|
scheduled_at { 1.minute.since }
|
2018-09-26 06:12:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :expired_scheduled do
|
|
|
|
schedulable
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'scheduled' }
|
2018-10-02 09:52:39 -04:00
|
|
|
scheduled_at { 1.minute.ago }
|
2018-09-26 06:12:48 -04:00
|
|
|
end
|
|
|
|
|
2016-07-16 19:48:51 -04:00
|
|
|
trait :manual do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'manual' }
|
|
|
|
self.when { 'manual' }
|
2016-07-16 19:48:51 -04:00
|
|
|
end
|
|
|
|
|
2016-11-21 11:26:35 -05:00
|
|
|
trait :teardown_environment do
|
2019-10-01 20:06:26 -04:00
|
|
|
environment { 'staging' }
|
2018-09-02 10:35:15 -04:00
|
|
|
options do
|
|
|
|
{
|
|
|
|
script: %w(ls),
|
|
|
|
environment: { name: 'staging',
|
2019-10-01 20:06:26 -04:00
|
|
|
action: 'stop',
|
|
|
|
url: 'http://staging.example.com/$CI_JOB_NAME' }
|
2018-09-02 10:35:15 -04:00
|
|
|
}
|
|
|
|
end
|
2018-11-04 19:37:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :deploy_to_production do
|
2019-10-01 20:06:26 -04:00
|
|
|
environment { 'production' }
|
2018-11-04 19:37:40 -05:00
|
|
|
|
2018-09-02 10:35:15 -04:00
|
|
|
options do
|
|
|
|
{
|
|
|
|
script: %w(ls),
|
|
|
|
environment: { name: 'production',
|
2019-10-01 20:06:26 -04:00
|
|
|
url: 'http://prd.example.com/$CI_JOB_NAME' }
|
2018-09-02 10:35:15 -04:00
|
|
|
}
|
|
|
|
end
|
2018-11-04 19:37:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :start_review_app do
|
2019-10-01 20:06:26 -04:00
|
|
|
environment { 'review/$CI_COMMIT_REF_NAME' }
|
2018-11-04 19:37:40 -05:00
|
|
|
|
2018-09-02 10:35:15 -04:00
|
|
|
options do
|
|
|
|
{
|
|
|
|
script: %w(ls),
|
|
|
|
environment: { name: 'review/$CI_COMMIT_REF_NAME',
|
2019-10-01 20:06:26 -04:00
|
|
|
url: 'http://staging.example.com/$CI_JOB_NAME',
|
|
|
|
on_stop: 'stop_review_app' }
|
2018-09-02 10:35:15 -04:00
|
|
|
}
|
|
|
|
end
|
2018-11-04 19:37:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :stop_review_app do
|
2019-10-01 20:06:26 -04:00
|
|
|
name { 'stop_review_app' }
|
|
|
|
environment { 'review/$CI_COMMIT_REF_NAME' }
|
2018-11-04 19:37:40 -05:00
|
|
|
|
2018-09-02 10:35:15 -04:00
|
|
|
options do
|
|
|
|
{
|
|
|
|
script: %w(ls),
|
|
|
|
environment: { name: 'review/$CI_COMMIT_REF_NAME',
|
2019-10-01 20:06:26 -04:00
|
|
|
url: 'http://staging.example.com/$CI_JOB_NAME',
|
|
|
|
action: 'stop' }
|
2018-09-02 10:35:15 -04:00
|
|
|
}
|
|
|
|
end
|
2016-11-21 11:26:35 -05:00
|
|
|
end
|
|
|
|
|
2016-02-18 05:47:35 -05:00
|
|
|
trait :allowed_to_fail do
|
2019-10-01 20:06:26 -04:00
|
|
|
allow_failure { true }
|
2016-02-18 05:47:35 -05:00
|
|
|
end
|
|
|
|
|
2017-03-02 07:45:01 -05:00
|
|
|
trait :ignored do
|
|
|
|
allowed_to_fail
|
|
|
|
end
|
|
|
|
|
2016-12-12 08:53:05 -05:00
|
|
|
trait :playable do
|
|
|
|
manual
|
|
|
|
end
|
|
|
|
|
2017-04-28 05:38:32 -04:00
|
|
|
trait :retryable do
|
|
|
|
success
|
|
|
|
end
|
|
|
|
|
2018-09-26 02:13:39 -04:00
|
|
|
trait :schedulable do
|
2019-10-01 20:06:26 -04:00
|
|
|
self.when { 'delayed' }
|
2018-09-02 10:35:15 -04:00
|
|
|
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
script: ['ls -a'],
|
|
|
|
start_in: '1 minute'
|
|
|
|
}
|
|
|
|
end
|
2018-09-26 02:13:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :actionable do
|
2019-10-01 20:06:26 -04:00
|
|
|
self.when { 'manual' }
|
2018-09-26 02:13:39 -04:00
|
|
|
end
|
|
|
|
|
2017-07-17 06:38:21 -04:00
|
|
|
trait :retried do
|
2019-10-01 20:06:26 -04:00
|
|
|
retried { true }
|
2017-07-17 06:38:21 -04:00
|
|
|
end
|
|
|
|
|
2017-04-28 05:38:32 -04:00
|
|
|
trait :cancelable do
|
|
|
|
pending
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :erasable do
|
|
|
|
success
|
|
|
|
artifacts
|
|
|
|
end
|
|
|
|
|
2017-03-01 05:39:36 -05:00
|
|
|
trait :tags do
|
2019-10-01 20:06:26 -04:00
|
|
|
tag_list do
|
|
|
|
[:docker, :ruby]
|
|
|
|
end
|
2017-03-01 05:39:36 -05:00
|
|
|
end
|
|
|
|
|
2017-03-01 05:57:06 -05:00
|
|
|
trait :on_tag do
|
2019-10-01 20:06:26 -04:00
|
|
|
tag { true }
|
2017-03-01 05:57:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :triggered do
|
2017-09-01 13:37:11 -04:00
|
|
|
trigger_request factory: :ci_trigger_request
|
2017-03-01 05:57:06 -05:00
|
|
|
end
|
|
|
|
|
2019-10-15 08:06:06 -04:00
|
|
|
trait :with_deployment do
|
|
|
|
after(:build) do |build, evaluator|
|
|
|
|
##
|
|
|
|
# Build deployment/environment relations if environment name is set
|
|
|
|
# to the job. If `build.deployment` has already been set, it doesn't
|
|
|
|
# build a new instance.
|
2020-03-03 19:07:52 -05:00
|
|
|
environment = Gitlab::Ci::Pipeline::Seed::Environment.new(build).to_resource
|
2019-10-15 08:06:06 -04:00
|
|
|
build.deployment =
|
2020-03-03 19:07:52 -05:00
|
|
|
Gitlab::Ci::Pipeline::Seed::Deployment.new(build, environment).to_resource
|
2019-10-15 08:06:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-10-30 05:25:28 -04:00
|
|
|
trait :tag do
|
2019-10-01 20:06:26 -04:00
|
|
|
tag { true }
|
2015-10-05 04:14:33 -04:00
|
|
|
end
|
2015-12-30 09:12:07 -05:00
|
|
|
|
2017-02-16 07:13:10 -05:00
|
|
|
trait :coverage do
|
2019-10-01 20:06:26 -04:00
|
|
|
coverage { 99.9 }
|
|
|
|
coverage_regex { '/(d+)/' }
|
2016-02-04 05:08:58 -05:00
|
|
|
end
|
|
|
|
|
2021-06-11 14:10:13 -04:00
|
|
|
trait :trace_with_coverage do
|
|
|
|
coverage { nil }
|
|
|
|
coverage_regex { '(\d+\.\d+)%' }
|
|
|
|
|
|
|
|
transient do
|
|
|
|
trace_coverage { 60.0 }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |build, evaluator|
|
|
|
|
build.trace.set("Coverage #{evaluator.trace_coverage}%")
|
|
|
|
build.trace.archive! if build.complete?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-05 04:07:37 -05:00
|
|
|
trait :trace_live do
|
2016-02-01 05:29:41 -05:00
|
|
|
after(:create) do |build, evaluator|
|
2017-04-06 12:20:27 -04:00
|
|
|
build.trace.set('BUILD TRACE')
|
2016-01-11 10:30:01 -05:00
|
|
|
end
|
2015-12-30 09:12:07 -05:00
|
|
|
end
|
2016-02-02 09:51:48 -05:00
|
|
|
|
2018-01-31 07:56:04 -05:00
|
|
|
trait :trace_artifact do
|
|
|
|
after(:create) do |build, evaluator|
|
|
|
|
create(:ci_job_artifact, :trace, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-17 10:22:40 -04:00
|
|
|
trait :trace_with_duplicate_sections do
|
2019-06-13 07:23:18 -04:00
|
|
|
after(:create) do |build, evaluator|
|
|
|
|
trace = File.binread(
|
|
|
|
File.expand_path(
|
2019-06-17 10:22:40 -04:00
|
|
|
Rails.root.join('spec/fixtures/trace/trace_with_duplicate_sections')))
|
2019-06-13 07:23:18 -04:00
|
|
|
|
|
|
|
build.trace.set(trace)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-17 11:14:02 -04:00
|
|
|
trait :trace_with_sections do
|
|
|
|
after(:create) do |build, evaluator|
|
|
|
|
trace = File.binread(
|
|
|
|
File.expand_path(
|
|
|
|
Rails.root.join('spec/fixtures/trace/trace_with_sections')))
|
|
|
|
|
|
|
|
build.trace.set(trace)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-05 04:07:37 -05:00
|
|
|
trait :unicode_trace_live do
|
2017-04-17 07:59:55 -04:00
|
|
|
after(:create) do |build, evaluator|
|
|
|
|
trace = File.binread(
|
|
|
|
File.expand_path(
|
|
|
|
Rails.root.join('spec/fixtures/trace/ansi-sequence-and-unicode')))
|
|
|
|
|
|
|
|
build.trace.set(trace)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-16 07:13:10 -05:00
|
|
|
trait :erased do
|
2018-09-20 13:02:36 -04:00
|
|
|
erased_at { Time.now }
|
2017-02-16 07:13:10 -05:00
|
|
|
erased_by factory: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :queued do
|
2018-09-20 13:02:36 -04:00
|
|
|
queued_at { Time.now }
|
2021-06-08 05:09:56 -04:00
|
|
|
|
|
|
|
after(:create) do |build|
|
|
|
|
build.create_queuing_entry!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :picked do
|
|
|
|
running
|
|
|
|
|
2017-02-16 07:13:10 -05:00
|
|
|
runner factory: :ci_runner
|
|
|
|
end
|
|
|
|
|
2016-02-02 09:51:48 -05:00
|
|
|
trait :artifacts do
|
2017-11-02 07:16:50 -04:00
|
|
|
after(:create) do |build|
|
2018-01-19 07:44:27 -05:00
|
|
|
create(:ci_job_artifact, :archive, job: build, expire_at: build.artifacts_expire_at)
|
|
|
|
create(:ci_job_artifact, :metadata, job: build, expire_at: build.artifacts_expire_at)
|
2017-11-02 14:38:25 -04:00
|
|
|
build.reload
|
2017-11-02 07:16:50 -04:00
|
|
|
end
|
2016-02-02 09:51:48 -05:00
|
|
|
end
|
2016-07-28 01:09:40 -04:00
|
|
|
|
2020-06-19 14:08:39 -04:00
|
|
|
trait :report_results do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.report_results << build(:ci_build_report_result)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-10 04:09:38 -05:00
|
|
|
trait :codequality_report do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :codequality, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :sast_report do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :sast, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :secret_detection_report do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :secret_detection, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-27 01:04:35 -04:00
|
|
|
trait :test_reports do
|
2018-08-03 07:08:13 -04:00
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :junit, job: build)
|
2018-07-27 01:04:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-03 02:09:14 -04:00
|
|
|
trait :test_reports_with_attachment do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :junit_with_attachment, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
trait :broken_test_reports do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :junit_with_corrupted_data, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-23 14:08:31 -04:00
|
|
|
trait :test_reports_with_duplicate_failed_test_names do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :junit_with_duplicate_failed_test_names, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-02 04:08:35 -05:00
|
|
|
trait :test_reports_with_three_failures do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :junit_with_three_failures, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-06 11:09:42 -04:00
|
|
|
trait :accessibility_reports do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :accessibility, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-17 14:09:44 -04:00
|
|
|
trait :coverage_reports do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :cobertura, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-23 10:09:37 -05:00
|
|
|
trait :codequality_reports do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :codequality, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-06 08:10:38 -04:00
|
|
|
trait :codequality_reports_without_degradation do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :codequality_without_errors, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
trait :terraform_reports do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.job_artifacts << create(:ci_job_artifact, :terraform, job: build)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-19 03:14:06 -04:00
|
|
|
trait :expired do
|
2018-09-20 13:02:36 -04:00
|
|
|
artifacts_expire_at { 1.minute.ago }
|
2016-07-28 01:09:40 -04:00
|
|
|
end
|
2017-01-18 05:38:59 -05:00
|
|
|
|
|
|
|
trait :with_commit do
|
|
|
|
after(:build) do |build|
|
|
|
|
allow(build).to receive(:commit).and_return build(:commit, :without_author)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_commit_and_author do
|
|
|
|
after(:build) do |build|
|
|
|
|
allow(build).to receive(:commit).and_return build(:commit)
|
|
|
|
end
|
|
|
|
end
|
2017-02-15 19:05:44 -05:00
|
|
|
|
|
|
|
trait :extended_options do
|
|
|
|
options do
|
|
|
|
{
|
2020-03-25 08:08:19 -04:00
|
|
|
image: { name: 'ruby:2.7', entrypoint: '/bin/sh' },
|
2019-10-01 20:06:26 -04:00
|
|
|
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }],
|
|
|
|
script: %w(echo),
|
|
|
|
after_script: %w(ls date),
|
|
|
|
artifacts: {
|
|
|
|
name: 'artifacts_file',
|
|
|
|
untracked: false,
|
|
|
|
paths: ['out/'],
|
|
|
|
when: 'always',
|
|
|
|
expire_in: '7d'
|
|
|
|
},
|
|
|
|
cache: {
|
|
|
|
key: 'cache_key',
|
|
|
|
untracked: false,
|
|
|
|
paths: ['vendor/*'],
|
2020-10-12 11:08:32 -04:00
|
|
|
policy: 'pull-push',
|
|
|
|
when: 'on_success'
|
2019-10-01 20:06:26 -04:00
|
|
|
}
|
2017-02-15 19:05:44 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2017-03-02 11:44:15 -05:00
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
trait :release_options do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
only: 'tags',
|
|
|
|
script: ['make changelog | tee release_changelog.txt'],
|
|
|
|
release: {
|
|
|
|
name: 'Release $CI_COMMIT_SHA',
|
|
|
|
description: 'Created using the release-cli $EXTRA_DESCRIPTION',
|
|
|
|
tag_name: 'release-$CI_COMMIT_SHA',
|
2021-05-10 23:10:35 -04:00
|
|
|
ref: '$CI_COMMIT_SHA',
|
|
|
|
assets: { links: [{ name: 'asset1', url: 'https://example.com/assets/1' }] }
|
2020-06-16 14:09:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-02 11:44:15 -05:00
|
|
|
trait :no_options do
|
|
|
|
options { {} }
|
|
|
|
end
|
2017-04-04 04:14:46 -04:00
|
|
|
|
2020-03-17 14:09:44 -04:00
|
|
|
# TODO: move Security traits to ee_ci_build
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/210486
|
2019-10-11 11:06:41 -04:00
|
|
|
trait :dast do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { reports: { dast: 'gl-dast-report.json' } }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :sast do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { reports: { sast: 'gl-sast-report.json' } }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-29 20:08:33 -04:00
|
|
|
trait :secret_detection do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { reports: { secret_detection: 'gl-secret-detection-report.json' } }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-10-11 11:06:41 -04:00
|
|
|
trait :dependency_scanning do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { reports: { dependency_scanning: 'gl-dependency-scanning-report.json' } }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :container_scanning do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { reports: { container_scanning: 'gl-container-scanning-report.json' } }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-06 05:07:05 -04:00
|
|
|
trait :cluster_image_scanning do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { reports: { cluster_image_scanning: 'gl-cluster-image-scanning-report.json' } }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-17 14:09:44 -04:00
|
|
|
trait :license_scanning do
|
|
|
|
options do
|
|
|
|
{
|
2021-03-03 19:11:19 -05:00
|
|
|
artifacts: { reports: { license_scanning: 'gl-license-scanning-report.json' } }
|
2020-03-17 14:09:44 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-12-20 19:10:18 -05:00
|
|
|
trait :non_public_artifacts do
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
artifacts: { public: false }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-04-04 04:14:46 -04:00
|
|
|
trait :non_playable do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 'created' }
|
|
|
|
self.when { 'manual' }
|
2017-04-04 04:14:46 -04:00
|
|
|
end
|
2017-08-22 04:01:11 -04:00
|
|
|
|
2017-08-31 08:13:40 -04:00
|
|
|
trait :protected do
|
2019-10-01 20:06:26 -04:00
|
|
|
add_attribute(:protected) { true }
|
2017-08-22 04:01:11 -04:00
|
|
|
end
|
2018-04-05 17:04:42 -04:00
|
|
|
|
|
|
|
trait :script_failure do
|
|
|
|
failed
|
2019-10-01 20:06:26 -04:00
|
|
|
failure_reason { 1 }
|
2018-04-05 17:04:42 -04:00
|
|
|
end
|
2018-04-19 03:20:53 -04:00
|
|
|
|
|
|
|
trait :api_failure do
|
|
|
|
failed
|
2019-10-01 20:06:26 -04:00
|
|
|
failure_reason { 2 }
|
2018-04-19 03:20:53 -04:00
|
|
|
end
|
2018-07-05 09:55:10 -04:00
|
|
|
|
2019-03-26 02:09:07 -04:00
|
|
|
trait :prerequisite_failure do
|
|
|
|
failed
|
2019-10-01 20:06:26 -04:00
|
|
|
failure_reason { 10 }
|
2019-03-26 02:09:07 -04:00
|
|
|
end
|
|
|
|
|
2020-11-10 07:08:57 -05:00
|
|
|
trait :forward_deployment_failure do
|
|
|
|
failed
|
|
|
|
failure_reason { 13 }
|
|
|
|
end
|
|
|
|
|
2018-07-05 09:55:10 -04:00
|
|
|
trait :with_runner_session do
|
|
|
|
after(:build) do |build|
|
2018-11-28 13:37:12 -05:00
|
|
|
build.build_runner_session(url: 'https://localhost')
|
2018-07-05 09:55:10 -04:00
|
|
|
end
|
|
|
|
end
|
2020-11-11 10:08:46 -05:00
|
|
|
|
|
|
|
trait :interruptible do
|
|
|
|
after(:build) do |build|
|
|
|
|
build.metadata.interruptible = true
|
|
|
|
end
|
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|