Commit 662f4b9e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add artifacts metadata uploader filed

Artifacts metadata field will be used to store a filename of gzipped
file containing metadata definition for given artifacts archive.
parent c177784d
......@@ -18,7 +18,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
return render_404 unless build.artifacts?
current_path = params[:path] ? "./#{params[:path]}/" : './'
artifacts_metadata = build.artifacts_metadata(current_path)
artifacts_metadata = build.artifacts_metadata_for(current_path)
@path = Gitlab::StringPath.new(current_path, artifacts_metadata)
end
......
......@@ -30,6 +30,7 @@
# description :string(255)
# artifacts_file :text
# gl_project_id :integer
# artifacts_metadata :text
#
module Ci
......@@ -50,6 +51,7 @@ module Ci
scope :similar, ->(build) { where(ref: build.ref, tag: build.tag, trigger_request_id: build.trigger_request_id) }
mount_uploader :artifacts_file, ArtifactUploader
mount_uploader :artifacts_metadata, ArtifactUploader
acts_as_taggable
......@@ -344,11 +346,11 @@ module Ci
def artifacts_browser_supported?
# TODO, since carrierwave 0.10.0 we will be able to check mime type here
#
artifacts? && artifacts_file.path.end_with?('zip')
artifacts? && artifacts_file.path.end_with?('zip') && artifacts_metadata.exists?
end
def artifacts_metadata(path)
[]
def artifacts_metadata_for(path)
{}
end
private
......
class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration
def change
add_column :ci_builds, :artifacts_metadata, :text
end
end
......@@ -123,6 +123,7 @@ ActiveRecord::Schema.define(version: 20160113111034) do
t.string "description"
t.text "artifacts_file"
t.integer "gl_project_id"
t.text "artifacts_metadata"
end
add_index "ci_builds", ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment