diff options
Diffstat (limited to 'lib/gitlab/ci/pipeline')
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/build.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/create_deployments.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/ensure_environments.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/ensure_resource_groups.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/logger.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/seed/build.rb | 35 |
6 files changed, 3 insertions, 44 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/build.rb b/lib/gitlab/ci/pipeline/chain/build.rb index bbdc6b65b96..6feb693221b 100644 --- a/lib/gitlab/ci/pipeline/chain/build.rb +++ b/lib/gitlab/ci/pipeline/chain/build.rb @@ -21,10 +21,6 @@ module Gitlab merge_request: @command.merge_request, external_pull_request: @command.external_pull_request, locked: @command.project.default_pipeline_lock) - - # Initialize the feature flag at the beginning of the pipeline creation process - # so that the flag references in the latter chains return the same value. - @pipeline.create_deployment_in_separate_transaction? end def break? diff --git a/lib/gitlab/ci/pipeline/chain/create_deployments.rb b/lib/gitlab/ci/pipeline/chain/create_deployments.rb index b913ba3c87d..a8276d84b87 100644 --- a/lib/gitlab/ci/pipeline/chain/create_deployments.rb +++ b/lib/gitlab/ci/pipeline/chain/create_deployments.rb @@ -6,8 +6,6 @@ module Gitlab module Chain class CreateDeployments < Chain::Base def perform! - return unless pipeline.create_deployment_in_separate_transaction? - create_deployments! end diff --git a/lib/gitlab/ci/pipeline/chain/ensure_environments.rb b/lib/gitlab/ci/pipeline/chain/ensure_environments.rb index 424e1d87fb4..245ef32f06b 100644 --- a/lib/gitlab/ci/pipeline/chain/ensure_environments.rb +++ b/lib/gitlab/ci/pipeline/chain/ensure_environments.rb @@ -6,8 +6,6 @@ module Gitlab module Chain class EnsureEnvironments < Chain::Base def perform! - return unless pipeline.create_deployment_in_separate_transaction? - pipeline.stages.map(&:statuses).flatten.each(&method(:ensure_environment)) end diff --git a/lib/gitlab/ci/pipeline/chain/ensure_resource_groups.rb b/lib/gitlab/ci/pipeline/chain/ensure_resource_groups.rb index f4e5e6e467a..8e60cafb65b 100644 --- a/lib/gitlab/ci/pipeline/chain/ensure_resource_groups.rb +++ b/lib/gitlab/ci/pipeline/chain/ensure_resource_groups.rb @@ -6,8 +6,6 @@ module Gitlab module Chain class EnsureResourceGroups < Chain::Base def perform! - return unless pipeline.create_deployment_in_separate_transaction? - pipeline.stages.map(&:statuses).flatten.each(&method(:ensure_resource_group)) end diff --git a/lib/gitlab/ci/pipeline/logger.rb b/lib/gitlab/ci/pipeline/logger.rb index fbba12c11a9..10c0fe295f8 100644 --- a/lib/gitlab/ci/pipeline/logger.rb +++ b/lib/gitlab/ci/pipeline/logger.rb @@ -59,7 +59,7 @@ module Gitlab attributes = { class: self.class.name.to_s, pipeline_creation_caller: caller, - project_id: project.id, + project_id: project&.id, # project is not available when called from `/ci/lint` pipeline_persisted: pipeline.persisted?, pipeline_source: pipeline.source, pipeline_creation_service_duration_s: age diff --git a/lib/gitlab/ci/pipeline/seed/build.rb b/lib/gitlab/ci/pipeline/seed/build.rb index 5a0ad695741..901208f325a 100644 --- a/lib/gitlab/ci/pipeline/seed/build.rb +++ b/lib/gitlab/ci/pipeline/seed/build.rb @@ -79,9 +79,7 @@ module Gitlab def to_resource strong_memoize(:resource) do - processable = initialize_processable - assign_resource_group(processable) unless @pipeline.create_deployment_in_separate_transaction? - processable + initialize_processable end end @@ -89,39 +87,10 @@ module Gitlab if bridge? ::Ci::Bridge.new(attributes) else - ::Ci::Build.new(attributes).tap do |build| - unless @pipeline.create_deployment_in_separate_transaction? - build.assign_attributes(self.class.deployment_attributes_for(build)) - end - end + ::Ci::Build.new(attributes) end end - def assign_resource_group(processable) - processable.resource_group = - Seed::Processable::ResourceGroup.new(processable, @resource_group_key) - .to_resource - end - - def self.deployment_attributes_for(build, environment = nil) - return {} unless build.has_environment? - - environment = Seed::Environment.new(build).to_resource if environment.nil? - - unless environment.persisted? - return { status: :failed, failure_reason: :environment_creation_failure } - end - - build.persisted_environment = environment - - { - deployment: Seed::Deployment.new(build, environment).to_resource, - metadata_attributes: { - expanded_environment_name: environment.name - } - } - end - private delegate :logger, to: :@context |