Remove the culcuration method of metadata size
This commit is contained in:
parent
eac4c75be9
commit
ca4e5d33e2
|
|
@ -36,6 +36,7 @@ module Gitlab
|
||||||
def perform(start_id, stop_id)
|
def perform(start_id, stop_id)
|
||||||
rows = []
|
rows = []
|
||||||
|
|
||||||
|
# Build rows
|
||||||
MigrateLegacyArtifacts::Build
|
MigrateLegacyArtifacts::Build
|
||||||
.legacy_artifacts
|
.legacy_artifacts
|
||||||
.where(id: (start_id..stop_id)).each do |build|
|
.where(id: (start_id..stop_id)).each do |build|
|
||||||
|
|
@ -58,7 +59,7 @@ module Gitlab
|
||||||
|
|
||||||
if build.artifacts_metadata
|
if build.artifacts_metadata
|
||||||
rows << base_param.merge({
|
rows << base_param.merge({
|
||||||
size: get_legacy_metadata_size(build), # `size` of legacy metadatas had not been persisted
|
size: nil, # `size` of legacy metadatas had not been persisted
|
||||||
file: build.artifacts_metadata,
|
file: build.artifacts_metadata,
|
||||||
file_store: build.artifacts_metadata_store || JobArtifact::LOCAL_STORE,
|
file_store: build.artifacts_metadata_store || JobArtifact::LOCAL_STORE,
|
||||||
file_type: MigrateLegacyArtifacts::JobArtifact.file_types['metadata'],
|
file_type: MigrateLegacyArtifacts::JobArtifact.file_types['metadata'],
|
||||||
|
|
@ -67,11 +68,10 @@ module Gitlab
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Bulk insert
|
||||||
Gitlab::Database
|
Gitlab::Database
|
||||||
.bulk_insert(MigrateLegacyArtifacts::JobArtifact.table_name, rows)
|
.bulk_insert(MigrateLegacyArtifacts::JobArtifact.table_name, rows)
|
||||||
|
|
||||||
# TODO: Do we need to verify the file existance with created job artifacts?
|
|
||||||
|
|
||||||
# Clean columns of ci_builds
|
# Clean columns of ci_builds
|
||||||
#
|
#
|
||||||
# Targets
|
# Targets
|
||||||
|
|
@ -80,7 +80,7 @@ module Gitlab
|
||||||
# "artifacts_size"
|
# "artifacts_size"
|
||||||
# "artifacts_file_store"
|
# "artifacts_file_store"
|
||||||
# Ignore
|
# Ignore
|
||||||
# "artifacts_expire_at" ,,, This is widely used for showing expiration time of artifacts
|
# "artifacts_expire_at" ... This is widely used for showing expiration time of artifacts
|
||||||
MigrateLegacyArtifacts::Build
|
MigrateLegacyArtifacts::Build
|
||||||
.legacy_artifacts
|
.legacy_artifacts
|
||||||
.where(id: (start_id..stop_id))
|
.where(id: (start_id..stop_id))
|
||||||
|
|
@ -89,17 +89,6 @@ module Gitlab
|
||||||
artifacts_size: nil,
|
artifacts_size: nil,
|
||||||
artifacts_file_store: nil)
|
artifacts_file_store: nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
##
|
|
||||||
# This method is efficient that request with HEAD method and get content-length,
|
|
||||||
# instead of pulling the whole data
|
|
||||||
def get_legacy_metadata_size(build)
|
|
||||||
legacy_file_path = File.join(build.created_at.utc.strftime('%Y_%m'), build.project_id.to_s, build.id.to_s, build.legacy_artifacts_metadata)
|
|
||||||
|
|
||||||
10 # TODO:
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue