diff options
Diffstat (limited to 'spec/factories/ci/builds.rb')
-rw-r--r-- | spec/factories/ci/builds.rb | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 011021f6320..56c12d73a3b 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -10,7 +10,7 @@ FactoryBot.define do options do { - image: 'ruby:2.7', + image: 'image:1.0', services: ['postgres'], script: ['ls -a'] } @@ -175,6 +175,58 @@ FactoryBot.define do end end + trait :prepare_staging do + name { 'prepare staging' } + environment { 'staging' } + + options do + { + script: %w(ls), + environment: { name: 'staging', action: 'prepare' } + } + end + + set_expanded_environment_name + end + + trait :start_staging do + name { 'start staging' } + environment { 'staging' } + + options do + { + script: %w(ls), + environment: { name: 'staging', action: 'start' } + } + end + + set_expanded_environment_name + end + + trait :stop_staging do + name { 'stop staging' } + environment { 'staging' } + + options do + { + script: %w(ls), + environment: { name: 'staging', action: 'stop' } + } + end + + set_expanded_environment_name + end + + trait :set_expanded_environment_name do + after(:build) do |build, evaluator| + build.assign_attributes( + metadata_attributes: { + expanded_environment_name: build.expanded_environment_name + } + ) + end + end + trait :allowed_to_fail do allow_failure { true } end @@ -455,7 +507,7 @@ FactoryBot.define do trait :extended_options do options do { - image: { name: 'ruby:2.7', entrypoint: '/bin/sh' }, + image: { name: 'image:1.0', entrypoint: '/bin/sh' }, services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }], script: %w(echo), after_script: %w(ls date), @@ -497,6 +549,22 @@ FactoryBot.define do options { {} } end + trait :coverage_report_cobertura do + options do + { + artifacts: { + expire_in: '7d', + reports: { + coverage_report: { + coverage_format: 'cobertura', + path: 'cobertura.xml' + } + } + } + } + end + end + # TODO: move Security traits to ee_ci_build # https://gitlab.com/gitlab-org/gitlab/-/issues/210486 trait :dast do |