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:
Diffstat (limited to 'app/controllers/concerns/runner_setup_scripts.rb')
-rw-r--r--app/controllers/concerns/runner_setup_scripts.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/concerns/runner_setup_scripts.rb b/app/controllers/concerns/runner_setup_scripts.rb
new file mode 100644
index 00000000000..c0e657a32d1
--- /dev/null
+++ b/app/controllers/concerns/runner_setup_scripts.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module RunnerSetupScripts
+ extend ActiveSupport::Concern
+
+ private
+
+ def private_runner_setup_scripts(**kwargs)
+ instructions = Gitlab::Ci::RunnerInstructions.new(current_user: current_user, os: script_params[:os], arch: script_params[:arch], **kwargs)
+ output = {
+ install: instructions.install_script,
+ register: instructions.register_command
+ }
+
+ if instructions.errors.any?
+ render json: { errors: instructions.errors }, status: :bad_request
+ else
+ render json: output
+ end
+ end
+
+ def script_params
+ params.permit(:os, :arch)
+ end
+end