summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-11-23 22:19:13 +0000
committerRobert Speicher <robert@gitlab.com>2015-11-23 22:19:13 +0000
commit31a34b591731eb8997da4844287d7c31e3686454 (patch)
tree9873ab0e39c86172efed56a6e99a19330578d640
parent2d77a21d5930ae3ed1a7e00c6c242569de2d55e5 (diff)
parent11728b50f96a296c760d9e69273d304f92e51f8f (diff)
downloadgitlab-ce-31a34b591731eb8997da4844287d7c31e3686454.tar.gz
Merge branch 'ci-artifacts-path' into 'master'
Expose artifacts path This fixes broken artifacts storage path. Fixes #3607 Fixes #3608 Related: gitlab-org/omnibus-gitlab!544 See merge request !1869
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/application_setting.rb2
-rw-r--r--app/uploaders/artifact_uploader.rb6
-rw-r--r--config/gitlab.yml.example6
-rw-r--r--config/initializers/1_settings.rb9
-rw-r--r--lib/ci/api/builds.rb2
-rw-r--r--lib/gitlab/current_settings.rb2
7 files changed, 22 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index eb5badf6a96..90ade156caf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@ v 8.2.1
v 8.2.0
- Improved performance of finding projects and groups in various places
- Improved performance of rendering user profile pages and Atom feeds
+ - Expose build artifacts path as config option
- Fix grouping of contributors by email in graph.
- Improved performance of finding issues with/without labels
- Remove CSS property preventing hard tabs from rendering in Chromium 45 (Stan Hu)
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 9e70247ef51..b2d5fe1558f 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -99,7 +99,7 @@ class ApplicationSetting < ActiveRecord::Base
restricted_signup_domains: Settings.gitlab['restricted_signup_domains'],
import_sources: ['github','bitbucket','gitlab','gitorious','google_code','fogbugz','git'],
shared_runners_enabled: Settings.gitlab_ci['shared_runners_enabled'],
- max_artifacts_size: Settings.gitlab_ci['max_artifacts_size'],
+ max_artifacts_size: Settings.artifacts['max_size'],
)
end
diff --git a/app/uploaders/artifact_uploader.rb b/app/uploaders/artifact_uploader.rb
index b4e0fc5772d..1dccc39e7e2 100644
--- a/app/uploaders/artifact_uploader.rb
+++ b/app/uploaders/artifact_uploader.rb
@@ -5,15 +5,15 @@ class ArtifactUploader < CarrierWave::Uploader::Base
attr_accessor :build, :field
def self.artifacts_path
- File.expand_path('shared/artifacts/', Rails.root)
+ Gitlab.config.artifacts.path
end
def self.artifacts_upload_path
- File.expand_path('shared/artifacts/tmp/uploads/', Rails.root)
+ File.join(self.artifacts_path, 'tmp/uploads/')
end
def self.artifacts_cache_path
- File.expand_path('shared/artifacts/tmp/cache/', Rails.root)
+ File.join(self.artifacts_path, 'tmp/cache/')
end
def initialize(build, field)
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 1788d4c2c7c..1da42ab38f3 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -124,6 +124,12 @@ production: &base
# The mailbox where incoming mail will end up. Usually "inbox".
mailbox: "inbox"
+ ## Build Artifacts
+ artifacts:
+ enabled: true
+ # The location where build artifacts are stored (default: shared/artifacts).
+ # path: shared/artifacts
+
## Git LFS
lfs:
enabled: true
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index b498fb1e1da..b162b8a83fc 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -187,7 +187,6 @@ Settings.gitlab_ci['all_broken_builds'] = true if Settings.gitlab_ci['all_br
Settings.gitlab_ci['add_pusher'] = false if Settings.gitlab_ci['add_pusher'].nil?
Settings.gitlab_ci['url'] ||= Settings.send(:build_gitlab_ci_url)
Settings.gitlab_ci['builds_path'] = File.expand_path(Settings.gitlab_ci['builds_path'] || "builds/", Rails.root)
-Settings.gitlab_ci['max_artifacts_size'] ||= 100 # in megabytes
#
# Reply by email
@@ -200,6 +199,14 @@ Settings.incoming_email['start_tls'] = false if Settings.incoming_email['start_
Settings.incoming_email['mailbox'] = "inbox" if Settings.incoming_email['mailbox'].nil?
#
+# Build Artifacts
+#
+Settings['artifacts'] ||= Settingslogic.new({})
+Settings.artifacts['enabled'] = true if Settings.artifacts['enabled'].nil?
+Settings.artifacts['path'] = File.expand_path(Settings.artifacts['path'] || File.join(Settings.shared['path'], "artifacts"), Rails.root)
+Settings.artifacts['max_size'] ||= 100 # in megabytes
+
+#
# Git LFS
#
Settings['lfs'] ||= Settingslogic.new({})
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb
index 0a586672807..15faa6edd84 100644
--- a/lib/ci/api/builds.rb
+++ b/lib/ci/api/builds.rb
@@ -58,6 +58,7 @@ module Ci
# POST /builds/:id/artifacts/authorize
post ":id/artifacts/authorize" do
require_gitlab_workhorse!
+ not_allowed! unless Gitlab.config.artifacts.enabled
build = Ci::Build.find_by_id(params[:id])
not_found! unless build
authenticate_build_token!(build)
@@ -91,6 +92,7 @@ module Ci
# POST /builds/:id/artifacts
post ":id/artifacts" do
require_gitlab_workhorse!
+ not_allowed! unless Gitlab.config.artifacts.enabled
build = Ci::Build.find_by_id(params[:id])
not_found! unless build
authenticate_build_token!(build)
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index 2d3e32d9539..46a4ef0e31f 100644
--- a/lib/gitlab/current_settings.rb
+++ b/lib/gitlab/current_settings.rb
@@ -25,7 +25,7 @@ module Gitlab
session_expire_delay: Settings.gitlab['session_expire_delay'],
import_sources: Settings.gitlab['import_sources'],
shared_runners_enabled: Settings.gitlab_ci['shared_runners_enabled'],
- max_artifacts_size: Ci::Settings.gitlab_ci['max_artifacts_size'],
+ max_artifacts_size: Settings.artifacts['max_size'],
)
end