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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 3d8e9f4c126..46fc87a6ea8 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -62,6 +62,9 @@ module Ci
delegate :gitlab_deploy_token, to: :project
delegate :trigger_short_token, to: :trigger_request, allow_nil: true
+ ignore_columns :id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
+ ignore_columns :stage_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
+
##
# Since Gitlab 11.5, deployments records started being created right after
# `ci_builds` creation. We can look up a relevant `environment` through
@@ -85,6 +88,16 @@ module Ci
end
end
+ # Initializing an object instead of fetching `persisted_environment` for avoiding unnecessary queries.
+ # We're planning to introduce a direct relationship between build and environment
+ # in https://gitlab.com/gitlab-org/gitlab/-/issues/326445 to let us to preload
+ # in batch.
+ def instantized_environment
+ return unless has_environment?
+
+ ::Environment.new(project: self.project, name: self.expanded_environment_name)
+ end
+
serialize :options # rubocop:disable Cop/ActiveRecordSerialize
serialize :yaml_variables, Gitlab::Serializer::Ci::Variables # rubocop:disable Cop/ActiveRecordSerialize
@@ -330,7 +343,7 @@ module Ci
begin
build.deployment.drop!
- rescue => e
+ rescue StandardError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, build_id: build.id)
end
@@ -1047,7 +1060,7 @@ module Ci
end
def build_data
- @build_data ||= Gitlab::DataBuilder::Build.build(self)
+ strong_memoize(:build_data) { Gitlab::DataBuilder::Build.build(self) }
end
def successful_deployment_status
@@ -1141,4 +1154,4 @@ module Ci
end
end
-Ci::Build.prepend_if_ee('EE::Ci::Build')
+Ci::Build.prepend_mod_with('Ci::Build')