summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-07-04 10:47:18 +0900
committerShinya Maeda <shinya@gitlab.com>2018-07-04 10:47:18 +0900
commitdd73f75ad5ad353d642333bb89e59efc011caeea (patch)
treede60329e7e5b5d1bdf57651b848a7e293824baf2
parente90e171997e144d2a34c2066ecf5a450d1736f06 (diff)
downloadgitlab-ce-extend-junit-keyword-ce.tar.gz
Revert persisting file_format in databaseextend-junit-keyword-ce
-rw-r--r--app/models/ci/job_artifact.rb8
-rw-r--r--db/migrate/20180701230554_add_file_format_to_ci_job_artifacts.rb9
-rw-r--r--db/schema.rb1
-rw-r--r--lib/api/runner.rb5
-rw-r--r--lib/gitlab/ci/trace.rb1
5 files changed, 3 insertions, 21 deletions
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb
index d205fffa1b0..33416802fc1 100644
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -4,6 +4,8 @@ module Ci
include ObjectStorage::BackgroundMove
extend Gitlab::Ci::Model
+ ACCEPTABLE_FILE_FORMAT = %w[zip gzip].freeze
+
belongs_to :project
belongs_to :job, class_name: "Ci::Build", foreign_key: :job_id
@@ -26,12 +28,6 @@ module Ci
junit: 4
}
- enum file_format: {
- zip: 1,
- gzip: 2,
- raw: 3
- }
-
def update_file_store
# The file.object_store is set during `uploader.store!`
# which happens after object is inserted/updated
diff --git a/db/migrate/20180701230554_add_file_format_to_ci_job_artifacts.rb b/db/migrate/20180701230554_add_file_format_to_ci_job_artifacts.rb
deleted file mode 100644
index 69b8c0e596a..00000000000
--- a/db/migrate/20180701230554_add_file_format_to_ci_job_artifacts.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddFileFormatToCiJobArtifacts < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_job_artifacts, :file_format, :integer, limit: 2
- end
-end
diff --git a/db/schema.rb b/db/schema.rb
index c72c7dedce1..5d917abdbb5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -383,7 +383,6 @@ ActiveRecord::Schema.define(version: 20180629191052) do
t.datetime_with_timezone "expire_at"
t.string "file"
t.binary "file_sha256"
- t.integer "file_format", limit: 2
end
add_index "ci_job_artifacts", ["expire_at", "job_id"], name: "index_ci_job_artifacts_on_expire_at_and_job_id", using: :btree
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index 3f7960ca0df..9b1454e0340 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -234,7 +234,7 @@ module API
optional 'artifact_type', type: String, desc: %q(Type of the artifact (`archive` or `junit`)),
default: 'archive', values: Ci::JobArtifact.file_types.keys
optional 'artifact_format', type: String, desc: %q(Format of the artifact (`zip` or `gzip`)),
- default: 'zip', values: Ci::JobArtifact.file_formats.keys
+ default: 'zip', values: Ci::JobArtifact::ACCEPTABLE_FILE_FORMAT
optional 'metadata.path', type: String, desc: %q(path to locally stored body (generated by Workhorse))
optional 'metadata.name', type: String, desc: %q(filename (generated by Workhorse))
optional 'metadata.size', type: Integer, desc: %q(real size of metadata (generated by Workhorse))
@@ -257,7 +257,6 @@ module API
Gitlab::CurrentSettings.current_application_settings.default_artifacts_expire_in
artifact_type = params['artifact_type']
- artifact_format = params['artifact_format']
bad_request!("Already uploaded") if job.public_send("job_artifacts_#{artifact_type}") # rubocop:disable GitlabSecurity/PublicSend
@@ -265,7 +264,6 @@ module API
project: job.project,
file: artifacts,
file_type: artifact_type.to_sym,
- file_format: artifact_format.to_sym,
file_sha256: artifacts.sha256,
expire_in: expire_in)
@@ -274,7 +272,6 @@ module API
project: job.project,
file: metadata,
file_type: :metadata,
- file_format: :gzip,
file_sha256: metadata.sha256,
expire_in: expire_in)
end
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index 37cd8a2d8f8..a52d71225bb 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -161,7 +161,6 @@ module Gitlab
job.create_job_artifacts_trace!(
project: job.project,
file_type: :trace,
- file_format: :raw,
file: stream,
file_sha256: Digest::SHA256.file(path).hexdigest)
end