Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
338b79b968
commit
233b28cc10
|
|
@ -61,16 +61,7 @@ module Ci
|
||||||
# before we delete builds. By doing this, the relation should be empty and not fire any
|
# before we delete builds. By doing this, the relation should be empty and not fire any
|
||||||
# DELETE queries when the Ci::Build is destroyed. The next step is to remove `dependent: :destroy`.
|
# DELETE queries when the Ci::Build is destroyed. The next step is to remove `dependent: :destroy`.
|
||||||
# Details: https://gitlab.com/gitlab-org/gitlab/-/issues/24644#note_689472685
|
# Details: https://gitlab.com/gitlab-org/gitlab/-/issues/24644#note_689472685
|
||||||
# rubocop:disable Cop/ActiveRecordDependent -- See above
|
has_many :job_artifacts, class_name: 'Ci::JobArtifact', foreign_key: :job_id, dependent: :destroy, inverse_of: :job # rubocop:disable Cop/ActiveRecordDependent
|
||||||
has_many :job_artifacts,
|
|
||||||
->(build) { in_partition(build) },
|
|
||||||
class_name: 'Ci::JobArtifact',
|
|
||||||
foreign_key: :job_id,
|
|
||||||
partition_foreign_key: :partition_id,
|
|
||||||
dependent: :destroy,
|
|
||||||
inverse_of: :job
|
|
||||||
# rubocop:enable Cop/ActiveRecordDependent
|
|
||||||
|
|
||||||
has_many :job_variables, class_name: 'Ci::JobVariable', foreign_key: :job_id, inverse_of: :job
|
has_many :job_variables, class_name: 'Ci::JobVariable', foreign_key: :job_id, inverse_of: :job
|
||||||
has_many :job_annotations,
|
has_many :job_annotations,
|
||||||
->(build) { in_partition(build) },
|
->(build) { in_partition(build) },
|
||||||
|
|
@ -82,12 +73,8 @@ module Ci
|
||||||
|
|
||||||
has_many :pages_deployments, foreign_key: :ci_build_id, inverse_of: :ci_build
|
has_many :pages_deployments, foreign_key: :ci_build_id, inverse_of: :ci_build
|
||||||
|
|
||||||
Ci::JobArtifact.file_types.each_key do |key|
|
Ci::JobArtifact.file_types.each do |key, value|
|
||||||
has_one :"job_artifacts_#{key}", ->(build) { in_partition(build).with_file_types([key]) },
|
has_one :"job_artifacts_#{key}", -> { where(file_type: value) }, class_name: 'Ci::JobArtifact', foreign_key: :job_id, inverse_of: :job
|
||||||
class_name: 'Ci::JobArtifact',
|
|
||||||
foreign_key: :job_id,
|
|
||||||
partition_foreign_key: :partition_id,
|
|
||||||
inverse_of: :job
|
|
||||||
end
|
end
|
||||||
|
|
||||||
has_one :runner_manager_build,
|
has_one :runner_manager_build,
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,7 @@ module Ci
|
||||||
class_name: 'Ci::Build',
|
class_name: 'Ci::Build',
|
||||||
partition_foreign_key: :partition_id,
|
partition_foreign_key: :partition_id,
|
||||||
inverse_of: :trace_metadata
|
inverse_of: :trace_metadata
|
||||||
belongs_to :trace_artifact, # rubocop:disable Rails/InverseOf -- No clear relation to be used
|
belongs_to :trace_artifact, class_name: 'Ci::JobArtifact'
|
||||||
->(metadata) { in_partition(metadata) },
|
|
||||||
class_name: 'Ci::JobArtifact',
|
|
||||||
partition_foreign_key: :partition_id
|
|
||||||
|
|
||||||
partitionable scope: :build
|
partitionable scope: :build
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,7 @@ module Ci
|
||||||
PLAN_LIMIT_PREFIX = 'ci_max_artifact_size_'
|
PLAN_LIMIT_PREFIX = 'ci_max_artifact_size_'
|
||||||
|
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
belongs_to :job,
|
belongs_to :job, class_name: "Ci::Build", foreign_key: :job_id, inverse_of: :job_artifacts
|
||||||
->(artifact) { in_partition(artifact) },
|
|
||||||
class_name: "Ci::Build",
|
|
||||||
foreign_key: :job_id,
|
|
||||||
partition_foreign_key: :partition_id,
|
|
||||||
inverse_of: :job_artifacts
|
|
||||||
|
|
||||||
mount_file_store_uploader JobArtifactUploader, skip_store_file: true
|
mount_file_store_uploader JobArtifactUploader, skip_store_file: true
|
||||||
|
|
||||||
|
|
@ -159,10 +154,6 @@ module Ci
|
||||||
service.update_statistics
|
service.update_statistics
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.use_partition_id_filter?
|
|
||||||
::Feature.enabled?(:use_partition_id_filter_on_ci_job_artifacts, Feature.current_request)
|
|
||||||
end
|
|
||||||
|
|
||||||
def local_store?
|
def local_store?
|
||||||
[nil, ::JobArtifactUploader::Store::LOCAL].include?(self.file_store)
|
[nil, ::JobArtifactUploader::Store::LOCAL].include?(self.file_store)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,10 @@ module Ci
|
||||||
|
|
||||||
builds_relation.each_batch(of: BATCH_SIZE) do |builds|
|
builds_relation.each_batch(of: BATCH_SIZE) do |builds|
|
||||||
# rubocop: disable CodeReuse/ActiveRecord
|
# rubocop: disable CodeReuse/ActiveRecord
|
||||||
Ci::JobArtifact.where(job_id: builds.pluck(:id), partition_id: partition_id)
|
Ci::JobArtifact.where(job_id: builds.pluck(:id)).each_batch(of: BATCH_SIZE) do |job_artifacts|
|
||||||
.each_batch(of: BATCH_SIZE) do |job_artifacts|
|
unlocked_count = Ci::JobArtifact
|
||||||
unlocked_count = Ci::JobArtifact.where(
|
.where(id: job_artifacts.pluck(:id))
|
||||||
id: job_artifacts.pluck(:id),
|
.update_all(locked: :unlocked)
|
||||||
partition_id: partition_id
|
|
||||||
).update_all(locked: :unlocked)
|
|
||||||
|
|
||||||
@unlocked_job_artifacts_count ||= 0
|
@unlocked_job_artifacts_count ||= 0
|
||||||
@unlocked_job_artifacts_count += unlocked_count
|
@unlocked_job_artifacts_count += unlocked_count
|
||||||
|
|
@ -112,12 +110,6 @@ module Ci
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# All the partitionable entities connected to a pipeline
|
|
||||||
# belong to the same partition where the pipeline is.
|
|
||||||
def partition_id
|
|
||||||
pipeline.partition_id
|
|
||||||
end
|
|
||||||
|
|
||||||
def unlock_pipeline_artifacts
|
def unlock_pipeline_artifacts
|
||||||
@unlocked_pipeline_artifacts_count = pipeline.pipeline_artifacts.update_all(locked: :unlocked)
|
@unlocked_pipeline_artifacts_count = pipeline.pipeline_artifacts.update_all(locked: :unlocked)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
name: use_partition_id_filter_on_ci_job_artifacts
|
|
||||||
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/430294
|
|
||||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/145522
|
|
||||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/444191
|
|
||||||
milestone: '16.10'
|
|
||||||
group: group::pipeline execution
|
|
||||||
type: gitlab_com_derisk
|
|
||||||
default_enabled: false
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
namespace :grape do
|
namespace :grape do
|
||||||
desc 'Print compiled grape routes'
|
desc 'Print compiled grape routes'
|
||||||
task routes: :environment do
|
task routes: :environment do
|
||||||
# Getting the source of the endpoints
|
|
||||||
# https://forum.gitlab.com/t/corresponding-ruby-file-for-route-api-v4-jobs-request/16663
|
|
||||||
API::API.routes.each do |route|
|
API::API.routes.each do |route|
|
||||||
puts "#{route.options[:method]} #{route.path} - #{route_description(route.options)}"
|
puts "#{route.options[:method]} #{route.path} - #{route_description(route.options)}"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1938,6 +1938,9 @@ msgstr ""
|
||||||
msgid "AIAgents|AI Agents"
|
msgid "AIAgents|AI Agents"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "AIAgents|Agent Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "AIAgents|An error has occurred when saving the agent."
|
msgid "AIAgents|An error has occurred when saving the agent."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
@ -1950,6 +1953,9 @@ msgstr ""
|
||||||
msgid "AIAgents|The requested agent was not found."
|
msgid "AIAgents|The requested agent was not found."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "AIAgents|Update the name and prompt for this agent."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "AIAgent|AI Agent: %{agentId}"
|
msgid "AIAgent|AI Agent: %{agentId}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,6 @@ RSpec.describe Gitlab::Ci::Trace::Archive, feature_category: :scalability do
|
||||||
|
|
||||||
allow_next_instance_of(Ci::JobArtifact) do |artifact|
|
allow_next_instance_of(Ci::JobArtifact) do |artifact|
|
||||||
artifact.job_id = job.id
|
artifact.job_id = job.id
|
||||||
artifact.partition_id = job.partition_id
|
|
||||||
|
|
||||||
expect(artifact)
|
expect(artifact)
|
||||||
.to receive(:store_file!)
|
.to receive(:store_file!)
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,7 @@ RSpec.describe Ci::UnlockPipelineService, :unlock_pipelines, :clean_gitlab_redis
|
||||||
before do
|
before do
|
||||||
mock_relation = instance_double('Ci::JobArtifact::ActiveRecord_Relation')
|
mock_relation = instance_double('Ci::JobArtifact::ActiveRecord_Relation')
|
||||||
allow(Ci::JobArtifact).to receive(:where).and_call_original
|
allow(Ci::JobArtifact).to receive(:where).and_call_original
|
||||||
allow(Ci::JobArtifact).to receive(:where)
|
allow(Ci::JobArtifact).to receive(:where).with(id: [last_artifact.id]).and_return(mock_relation)
|
||||||
.with(id: [last_artifact.id], partition_id: last_artifact.partition_id)
|
|
||||||
.and_return(mock_relation)
|
|
||||||
allow(mock_relation).to receive(:update_all).and_raise('An error')
|
allow(mock_relation).to receive(:update_all).and_raise('An error')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue