summaryrefslogtreecommitdiff
path: root/db/fixtures
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 08:27:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 08:27:35 +0000
commit7e9c479f7de77702622631cff2628a9c8dcbc627 (patch)
treec8f718a08e110ad7e1894510980d2155a6549197 /db/fixtures
parente852b0ae16db4052c1c567d9efa4facc81146e88 (diff)
downloadgitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/development/02_application_settings.rb3
-rw-r--r--db/fixtures/development/12_snippets.rb26
-rw-r--r--db/fixtures/production/010_settings.rb4
3 files changed, 32 insertions, 1 deletions
diff --git a/db/fixtures/development/02_application_settings.rb b/db/fixtures/development/02_application_settings.rb
index 67486d2ab5f..46da3205d8f 100644
--- a/db/fixtures/development/02_application_settings.rb
+++ b/db/fixtures/development/02_application_settings.rb
@@ -7,4 +7,7 @@ ApplicationSetting.create_from_defaults
puts "Enable hashed storage for every new projects.".color(:green)
ApplicationSetting.current_without_cache.update!(hashed_storage_enabled: true)
+puts "Generate CI JWT signing key".color(:green)
+ApplicationSetting.current_without_cache.update!(ci_jwt_signing_key: OpenSSL::PKey::RSA.new(2048).to_pem)
+
print '.'
diff --git a/db/fixtures/development/12_snippets.rb b/db/fixtures/development/12_snippets.rb
index 8ceabcdcd9b..6d31007b320 100644
--- a/db/fixtures/development/12_snippets.rb
+++ b/db/fixtures/development/12_snippets.rb
@@ -1,6 +1,28 @@
require './spec/support/sidekiq_middleware'
SNIPPET_REPO_URL = "https://gitlab.com/gitlab-org/gitlab-snippet-test.git"
+BUNDLE_PATH = File.join(Rails.root, 'db/fixtures/development/gitlab-snippet-test.bundle')
+
+class Gitlab::Seeder::SnippetRepository
+ def initialize(snippet)
+ @snippet = snippet
+ end
+
+ def import
+ if File.exists?(BUNDLE_PATH)
+ @snippet.repository.create_from_bundle(BUNDLE_PATH)
+ else
+ @snippet.repository.import_repository(SNIPPET_REPO_URL)
+ @snippet.repository.bundle_to_disk(BUNDLE_PATH)
+ end
+ end
+
+ def self.cleanup
+ File.delete(BUNDLE_PATH) if File.exists?(BUNDLE_PATH)
+ rescue => e
+ warn "\nError cleaning up snippet bundle: #{e}"
+ end
+end
Gitlab::Seeder.quiet do
20.times do |i|
@@ -14,7 +36,7 @@ Gitlab::Seeder.quiet do
content: 'foo'
}).tap do |snippet|
unless snippet.repository_exists?
- snippet.repository.import_repository(SNIPPET_REPO_URL)
+ Gitlab::Seeder::SnippetRepository.new(snippet).import
end
snippet.track_snippet_repository(snippet.repository.storage)
@@ -23,5 +45,7 @@ Gitlab::Seeder.quiet do
print('.')
end
+
+ Gitlab::Seeder::SnippetRepository.cleanup
end
diff --git a/db/fixtures/production/010_settings.rb b/db/fixtures/production/010_settings.rb
index 7626cdb0b9c..65f70a9e715 100644
--- a/db/fixtures/production/010_settings.rb
+++ b/db/fixtures/production/010_settings.rb
@@ -24,3 +24,7 @@ if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present?
settings.prometheus_metrics_enabled = value
save(settings, 'Prometheus metrics enabled flag')
end
+
+settings = Gitlab::CurrentSettings.current_application_settings
+settings.ci_jwt_signing_key = OpenSSL::PKey::RSA.new(2048).to_pem
+save(settings, 'CI JWT signing key')