summaryrefslogtreecommitdiff
path: root/db/fixtures
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /db/fixtures
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
downloadgitlab-ce-edaa33dee2ff2f7ea3fac488d41558eb5f86d68c.tar.gz
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/development/18_abuse_reports.rb2
-rw-r--r--db/fixtures/development/31_terraform_state.rb26
2 files changed, 27 insertions, 1 deletions
diff --git a/db/fixtures/development/18_abuse_reports.rb b/db/fixtures/development/18_abuse_reports.rb
index 88d2f784852..b06beca35e9 100644
--- a/db/fixtures/development/18_abuse_reports.rb
+++ b/db/fixtures/development/18_abuse_reports.rb
@@ -11,7 +11,7 @@ module Db
name: FFaker::Name.name,
email: FFaker::Internet.email,
confirmed_at: DateTime.now,
- password: '12345678'
+ password: Gitlab::Password.test_default
)
::AbuseReport.create(reporter: ::User.take, user: reported_user, message: 'User sends spam')
diff --git a/db/fixtures/development/31_terraform_state.rb b/db/fixtures/development/31_terraform_state.rb
new file mode 100644
index 00000000000..76f9c270f72
--- /dev/null
+++ b/db/fixtures/development/31_terraform_state.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+TERRAFORM_FILE_VERSION = 1
+
+# Create sample terraform states in existing projects
+Gitlab::Seeder.quiet do
+ tfdata = {terraform_version: '0.14.1'}.to_json
+
+ Project.not_mass_generated.find_each do |project|
+ # Create as the project's creator
+ user = project.creator
+ # Set a build job source, if one exists for the project
+ build = project.builds.last
+
+ remote_state_handler = ::Terraform::RemoteStateHandler.new(project, user, name: project.path, lock_id: nil)
+
+ remote_state_handler.handle_with_lock do |state|
+ # Upload a file if a version does not already exist
+ state.update_file!(CarrierWaveStringFile.new(tfdata), version: TERRAFORM_FILE_VERSION, build: build) if state.latest_version.nil?
+ end
+
+ # rubocop:disable Rails/Output
+ print '.'
+ # rubocop:enable Rails/Output
+ end
+end