summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-18 19:51:58 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-18 19:51:58 +0100
commit977fdbe830579d7455ee50240f92cbd8ae7c678a (patch)
treed701e1a069ca2b30dd7bbff76af34f0e587105c8 /lib
parent9805fe1914f28693eb0be4f8c2d8377050dd2ebb (diff)
parent7f7eef2aef31f9cd4297d25d4416515182aa9482 (diff)
downloadgitlab-ce-977fdbe830579d7455ee50240f92cbd8ae7c678a.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into cache-clear
Diffstat (limited to 'lib')
-rw-r--r--lib/api/repositories.rb7
-rw-r--r--lib/ci/status.rb4
-rw-r--r--lib/gitlab/push_data_builder.rb2
-rw-r--r--lib/gitlab/workhorse.rb27
-rw-r--r--lib/tasks/gitlab/check.rake1
5 files changed, 28 insertions, 13 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index c95d2d2001d..0d0f0d4616d 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -98,11 +98,8 @@ module API
authorize! :download_code, user_project
begin
- ArchiveRepositoryService.new(
- user_project,
- params[:sha],
- params[:format]
- ).execute
+ RepositoryArchiveCacheWorker.perform_async
+ header *Gitlab::Workhorse.send_git_archive(user_project, params[:sha], params[:format])
rescue
not_found!('File')
end
diff --git a/lib/ci/status.rb b/lib/ci/status.rb
index c02b3b8f3e4..3fb1fe29494 100644
--- a/lib/ci/status.rb
+++ b/lib/ci/status.rb
@@ -1,11 +1,9 @@
module Ci
class Status
def self.get_status(statuses)
- statuses.reject! { |status| status.try(&:allow_failure?) }
-
if statuses.none?
'skipped'
- elsif statuses.all?(&:success?)
+ elsif statuses.all? { |status| status.success? || status.ignored? }
'success'
elsif statuses.all?(&:pending?)
'pending'
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb
index 1dad621aa00..da1c15fef61 100644
--- a/lib/gitlab/push_data_builder.rb
+++ b/lib/gitlab/push_data_builder.rb
@@ -22,6 +22,8 @@ module Gitlab
# }
#
def build(project, user, oldrev, newrev, ref, commits = [], message = nil)
+ commits = Array(commits)
+
# Total commits count
commits_count = commits.size
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index a23120a4176..c3ddd4c2680 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -3,19 +3,38 @@ require 'json'
module Gitlab
class Workhorse
+ SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data'
+
class << self
def send_git_blob(repository, blob)
- params_hash = {
+ params = {
'RepoPath' => repository.path_to_repo,
'BlobId' => blob.id,
}
- params = Base64.urlsafe_encode64(JSON.dump(params_hash))
[
- 'Gitlab-Workhorse-Send-Data',
- "git-blob:#{params}",
+ SEND_DATA_HEADER,
+ "git-blob:#{encode(params)}",
]
end
+
+ def send_git_archive(project, ref, format)
+ format ||= 'tar.gz'
+ format.downcase!
+ params = project.repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format)
+ raise "Repository or ref not found" if params.empty?
+
+ [
+ SEND_DATA_HEADER,
+ "git-archive:#{encode(params)}",
+ ]
+ end
+
+ protected
+
+ def encode(hash)
+ Base64.urlsafe_encode64(JSON.dump(hash))
+ end
end
end
end
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 54d95cd62a5..81099cb8ba9 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -16,7 +16,6 @@ namespace :gitlab do
check_git_config
check_database_config_exists
- check_database_is_not_sqlite
check_migrations_are_up
check_orphaned_group_members
check_gitlab_config_exists