Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /db/fixtures
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/development/12_snippets.rb45
-rw-r--r--db/fixtures/development/14_pipelines.rb2
-rw-r--r--db/fixtures/development/16_protected_branches.rb2
-rw-r--r--db/fixtures/development/25_api_personal_access_token.rb22
-rw-r--r--db/fixtures/development/28_integrations.rb28
5 files changed, 60 insertions, 39 deletions
diff --git a/db/fixtures/development/12_snippets.rb b/db/fixtures/development/12_snippets.rb
index 3fa172c8f0f..8ceabcdcd9b 100644
--- a/db/fixtures/development/12_snippets.rb
+++ b/db/fixtures/development/12_snippets.rb
@@ -1,40 +1,25 @@
require './spec/support/sidekiq_middleware'
-Gitlab::Seeder.quiet do
- content =<<eos
-class Member < ActiveRecord::Base
- include Notifiable
- include Gitlab::Access
-
- belongs_to :user
- belongs_to :source, polymorphic: true
-
- validates :user, presence: true
- validates :source, presence: true
- validates :user_id, uniqueness: { scope: [:source_type, :source_id], message: "already exists in source" }
- validates :access_level, inclusion: { in: Gitlab::Access.all_values }, presence: true
-
- scope :guests, -> { where(access_level: GUEST) }
- scope :reporters, -> { where(access_level: REPORTER) }
- scope :developers, -> { where(access_level: DEVELOPER) }
- scope :maintainers, -> { where(access_level: MAINTAINER) }
- scope :owners, -> { where(access_level: OWNER) }
+SNIPPET_REPO_URL = "https://gitlab.com/gitlab-org/gitlab-snippet-test.git"
- delegate :name, :username, :email, to: :user, prefix: true
-end
-eos
-
- 50.times do |i|
+Gitlab::Seeder.quiet do
+ 20.times do |i|
user = User.not_mass_generated.sample
- PersonalSnippet.seed(:id, [{
- id: i,
- author_id: user.id,
+ user.snippets.create({
+ type: 'PersonalSnippet',
title: FFaker::Lorem.sentence(3),
- file_name: FFaker::Internet.domain_word + '.rb',
+ file_name: 'file.rb',
visibility_level: Gitlab::VisibilityLevel.values.sample,
- content: content,
- }])
+ content: 'foo'
+ }).tap do |snippet|
+ unless snippet.repository_exists?
+ snippet.repository.import_repository(SNIPPET_REPO_URL)
+ end
+
+ snippet.track_snippet_repository(snippet.repository.storage)
+ snippet.statistics.refresh!
+ end
print('.')
end
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index 7a9b97dfefa..47d72c4c2e7 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -57,7 +57,7 @@ class Gitlab::Seeder::Pipelines
BUILDS.each { |opts| build_create!(pipeline, opts) }
EXTERNAL_JOBS.each { |opts| commit_status_create!(pipeline, opts) }
pipeline.update_duration
- pipeline.update_legacy_status
+ ::Ci::ProcessPipelineService.new(pipeline).execute
end
end
diff --git a/db/fixtures/development/16_protected_branches.rb b/db/fixtures/development/16_protected_branches.rb
index e6615b20f9c..e859c2c5130 100644
--- a/db/fixtures/development/16_protected_branches.rb
+++ b/db/fixtures/development/16_protected_branches.rb
@@ -1,7 +1,7 @@
require './spec/support/sidekiq_middleware'
Gitlab::Seeder.quiet do
- admin_user = User.find(1)
+ admin_user = User.admins.first
Project.not_mass_generated.each do |project|
params = {
diff --git a/db/fixtures/development/25_api_personal_access_token.rb b/db/fixtures/development/25_api_personal_access_token.rb
index 0a8fd86b440..9b0427b3a88 100644
--- a/db/fixtures/development/25_api_personal_access_token.rb
+++ b/db/fixtures/development/25_api_personal_access_token.rb
@@ -2,14 +2,22 @@
require './spec/support/sidekiq_middleware'
-# Create an api access token for root user with the value: ypCa3Dzb23o5nvsixwPA
+# Create an api access token for root user with the value:
+token = 'ypCa3Dzb23o5nvsixwPA'
+scopes = Gitlab::Auth.all_available_scopes
+
Gitlab::Seeder.quiet do
- PersonalAccessToken.create!(
- user_id: User.find_by(username: 'root').id,
- name: "seeded-api-token",
- scopes: ["api"],
- token_digest: "/O0jfLERYT/L5gG8nfByQxqTj43TeLlRzOtJGTzRsbQ="
- )
+ User.find_by(username: 'root').tap do |user|
+ params = {
+ scopes: scopes.map(&:to_s),
+ name: 'seeded-api-token'
+ }
+
+ user.personal_access_tokens.build(params).tap do |pat|
+ pat.set_token(token)
+ pat.save!
+ end
+ end
print '.'
end
diff --git a/db/fixtures/development/28_integrations.rb b/db/fixtures/development/28_integrations.rb
new file mode 100644
index 00000000000..db54593ae27
--- /dev/null
+++ b/db/fixtures/development/28_integrations.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+Gitlab::Seeder.quiet do
+ # This is only enabled if you're going to be using the customer portal in
+ # development.
+ # CUSTOMER_PORTAL_URL=https://your.ngrok.io FILTER=integrations rake db:seed_fu
+ flag = 'CUSTOMER_PORTAL_URL'
+
+ if ENV[flag]
+ ApplicationSetting.current_without_cache.update!(check_namespace_plan: true)
+
+ print '.'
+
+ Doorkeeper::Application.create!(
+ name: 'Customer Portal Development',
+ uid: '28cc28f03b415fbc737a7364dc06af0adf12688e1b0c6669baf6850a6855132b',
+ secret: '74c96596ec3f82dd137dd5775f31eba919f77b0a3114611f0411d148d727c64c',
+ redirect_uri: "#{ENV['CUSTOMER_PORTAL_URL']}/auth/gitlab/callback",
+ scopes: 'api read_user openid',
+ trusted: true,
+ confidential: true
+ )
+
+ print '.'
+ else
+ puts "Skipped. To enable, set the `#{flag}` environment variable to your development customer's portal url."
+ end
+end