summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 12:06:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 12:06:26 +0000
commitd2798d607e11e0ebae83ae909404834388733428 (patch)
tree096b7f4d4bdb315d28cdcd4d6db4e80911112e9c /bin
parentd8211a0ed119eada7d292e974a8fc7b0cd982d3c (diff)
downloadgitlab-ce-d2798d607e11e0ebae83ae909404834388733428.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'bin')
-rwxr-xr-xbin/elastic_repo_indexer101
1 files changed, 0 insertions, 101 deletions
diff --git a/bin/elastic_repo_indexer b/bin/elastic_repo_indexer
deleted file mode 100755
index 3dfe0c4164b..00000000000
--- a/bin/elastic_repo_indexer
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'rubygems'
-require 'bundler/setup'
-require 'json'
-require 'active_model'
-require 'active_support'
-require 'active_support/core_ext'
-require 'benchmark'
-require 'charlock_holmes'
-
-$: << File.expand_path('../lib', __dir__)
-$: << File.expand_path('../ee/lib', __dir__)
-
-require 'open3'
-require 'rugged'
-
-require 'gitlab/blob_helper'
-require 'gitlab/elastic/client'
-require 'elasticsearch/model'
-require 'elasticsearch/git'
-require 'elasticsearch/git/encoder_helper'
-require 'elasticsearch/git/lite_blob'
-require 'elasticsearch/git/model'
-require 'elasticsearch/git/repository'
-
-Thread.abort_on_exception = true
-
-path_to_log_file = File.expand_path('../log/es-indexer.log', __dir__)
-LOGGER = Logger.new(path_to_log_file)
-
-PROJECT_ID = ARGV.shift
-REPO_PATH = ARGV.shift
-FROM_SHA = ENV['FROM_SHA']
-TO_SHA = ENV['TO_SHA']
-RAILS_ENV = ENV['RAILS_ENV']
-
-# Symbols get stringified when passed through JSON
-elastic = {}
-JSON.parse(ENV['ELASTIC_CONNECTION_INFO']).each { |k, v| elastic[k.to_sym] = v }
-ELASTIC_CONFIG = elastic
-
-LOGGER.info("Has been scheduled for project #{REPO_PATH} with SHA range #{FROM_SHA}:#{TO_SHA}")
-
-class Repository
- include Elasticsearch::Git::Repository
-
- index_name ['gitlab', RAILS_ENV].compact.join('-')
-
- def initialize
- self.__elasticsearch__.client = ::Gitlab::Elastic::Client.build(ELASTIC_CONFIG)
- end
-
- def client_for_indexing
- self.__elasticsearch__.client
- end
-
- def repository_id
- PROJECT_ID
- end
-
- def project_id
- PROJECT_ID
- end
-
- def path_to_repo
- REPO_PATH
- end
-end
-
-repo = Repository.new
-
-params = { from_rev: FROM_SHA, to_rev: TO_SHA }.compact
-
-commit_thr = Thread.new do
- LOGGER.info("Indexing commits started")
-
- timings = Benchmark.measure do
- indexed = 0
- repo.index_commits(params) do |batch, total_count|
- indexed += batch.length
- LOGGER.info("Indexed #{indexed}/#{total_count} commits")
- end
- end
-
- LOGGER.info("Commits for #{REPO_PATH} are indexed. Time elapsed: #{timings.real}")
-end
-
-LOGGER.info("Indexing blobs started")
-
-timings = Benchmark.measure do
- indexed = 0
- repo.index_blobs(params) do |batch, total_count|
- indexed += batch.length
- LOGGER.info("Indexed #{indexed}/#{total_count} blobs")
- end
-end
-
-LOGGER.info("Blobs for #{REPO_PATH} are indexed. Time elapsed: #{timings.real}")
-
-commit_thr.join