summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /app/models/ci/build.rb
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
downloadgitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb58
1 files changed, 1 insertions, 57 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 990ef71a457..3fdc44bccf3 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -10,7 +10,6 @@ module Ci
include Presentable
include Importable
include Ci::HasRef
- include IgnorableColumns
BuildArchivedError = Class.new(StandardError)
@@ -70,9 +69,6 @@ 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.5', remove_after: '2021-10-22'
- ignore_columns :stage_id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
-
##
# Since Gitlab 11.5, deployments records started being created right after
# `ci_builds` creation. We can look up a relevant `environment` through
@@ -175,6 +171,7 @@ module Ci
scope :with_live_trace, -> { where('EXISTS (?)', Ci::BuildTraceChunk.where('ci_builds.id = ci_build_trace_chunks.build_id').select(1)) }
scope :with_stale_live_trace, -> { with_live_trace.finished_before(12.hours.ago) }
scope :finished_before, -> (date) { finished.where('finished_at < ?', date) }
+ scope :license_management_jobs, -> { where(name: %i(license_management license_scanning)) } # handle license rename https://gitlab.com/gitlab-org/gitlab/issues/8911
scope :with_secure_reports_from_config_options, -> (job_types) do
joins(:metadata).where("ci_builds_metadata.config_options -> 'artifacts' -> 'reports' ?| array[:job_types]", job_types: job_types)
@@ -313,12 +310,6 @@ module Ci
end
after_transition pending: :running do |build|
- unless build.update_deployment_after_transaction_commit?
- Gitlab::Database.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338867') do
- build.deployment&.run
- end
- end
-
build.run_after_commit do
build.pipeline.persistent_ref.create
@@ -339,12 +330,6 @@ module Ci
end
after_transition any => [:success] do |build|
- unless build.update_deployment_after_transaction_commit?
- Gitlab::Database.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338867') do
- build.deployment&.succeed
- end
- end
-
build.run_after_commit do
BuildSuccessWorker.perform_async(id)
PagesWorker.perform_async(:deploy, id) if build.pages_generator?
@@ -353,23 +338,6 @@ module Ci
after_transition any => [:failed] do |build|
next unless build.project
- next unless build.deployment
-
- unless build.update_deployment_after_transaction_commit?
- begin
- Gitlab::Database.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338867') do
- build.deployment.drop!
- end
- rescue StandardError => e
- Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, build_id: build.id)
- end
- end
-
- true
- end
-
- after_transition any => [:failed] do |build|
- next unless build.project
if build.auto_retry_allowed?
begin
@@ -380,25 +348,12 @@ module Ci
end
end
- after_transition any => [:skipped, :canceled] do |build, transition|
- unless build.update_deployment_after_transaction_commit?
- Gitlab::Database.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338867') do
- if transition.to_name == :skipped
- build.deployment&.skip
- else
- build.deployment&.cancel
- end
- end
- end
- end
-
# Synchronize Deployment Status
# Please note that the data integirty is not assured because we can't use
# a database transaction due to DB decomposition.
after_transition do |build, transition|
next if transition.loopback?
next unless build.project
- next unless build.update_deployment_after_transaction_commit?
build.run_after_commit do
build.deployment&.sync_status_with(build)
@@ -585,7 +540,6 @@ module Ci
.concat(persisted_variables)
.concat(dependency_proxy_variables)
.concat(job_jwt_variables)
- .concat(kubernetes_variables)
.concat(scoped_variables)
.concat(job_variables)
.concat(persisted_environment_variables)
@@ -1120,12 +1074,6 @@ module Ci
runner&.instance_type?
end
- def update_deployment_after_transaction_commit?
- strong_memoize(:update_deployment_after_transaction_commit) do
- Feature.enabled?(:update_deployment_after_transaction_commit, project, default_enabled: :yaml)
- end
- end
-
protected
def run_status_commit_hooks!
@@ -1213,10 +1161,6 @@ module Ci
end
end
- def kubernetes_variables
- [] # Overridden in EE
- end
-
def conditionally_allow_failure!(exit_code)
return unless exit_code