summaryrefslogtreecommitdiff
path: root/db/fixtures
diff options
context:
space:
mode:
authorDJ Mountney <david@twkie.net>2016-10-02 15:30:44 -0700
committerDJ Mountney <david@twkie.net>2016-12-01 17:21:21 -0800
commitfb5f7733f14b701f6e22a54bc8b4c08330bc036f (patch)
tree0c6986356b87ceb54226b039c9b72d3f65ff8c5b /db/fixtures
parent994530270899ae904fbf5a77b602990b8cd79c67 (diff)
downloadgitlab-ce-fb5f7733f14b701f6e22a54bc8b4c08330bc036f.tar.gz
Allow users to seed the initial runner registration token using an environment variable
This is useful for when runner is bundled with gitlab, like in a kubernetes stack, and we want the runner to be able to register with gitlab as soon as they both come up.
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/production/010_settings.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/fixtures/production/010_settings.rb b/db/fixtures/production/010_settings.rb
new file mode 100644
index 00000000000..5522f31629a
--- /dev/null
+++ b/db/fixtures/production/010_settings.rb
@@ -0,0 +1,16 @@
+if ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'].present?
+ settings = ApplicationSetting.current || ApplicationSetting.create_from_defaults
+ settings.set_runners_registration_token(ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'])
+
+ if settings.save
+ puts "Saved Runner Registration Token".color(:green)
+ else
+ puts "Could not save Runner Registration Token".color(:red)
+ puts
+ settings.errors.full_messages.map do |message|
+ puts "--> #{message}".color(:red)
+ end
+ puts
+ exit 1
+ end
+end