Class: Gitlab::Ci::RunnerInstructions
- Inherits:
-
Object
- Object
- Gitlab::Ci::RunnerInstructions
- Includes:
- Allowable
- Defined in:
- lib/gitlab/ci/runner_instructions.rb
Defined Under Namespace
Classes: ArgumentError
Constant Summary collapse
- OS =
{ linux: { human_readable_name: "Linux", download_locations: { amd64: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64", '386': "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386", arm: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm", arm64: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm64" }, install_script_template_path: "lib/gitlab/ci/runner_instructions/templates/linux/install.sh", runner_executable: "sudo gitlab-runner" }, osx: { human_readable_name: "macOS", download_locations: { amd64: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64", arm64: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-arm64" }, install_script_template_path: "lib/gitlab/ci/runner_instructions/templates/osx/install.sh", runner_executable: "gitlab-runner" }, windows: { human_readable_name: "Windows", download_locations: { amd64: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-windows-amd64.exe", '386': "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-windows-386.exe" }, install_script_template_path: "lib/gitlab/ci/runner_instructions/templates/windows/install.ps1", runner_executable: "./gitlab-runner.exe" } }.freeze
- OTHER_ENVIRONMENTS =
{ docker: { human_readable_name: "Docker", installation_instructions_url: "https://docs.gitlab.com/runner/install/docker.html" }, kubernetes: { human_readable_name: "Kubernetes", installation_instructions_url: "https://docs.gitlab.com/runner/install/kubernetes.html" }, aws: { human_readable_name: "AWS" } }.freeze
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(os:, arch:) ⇒ RunnerInstructions
constructor
A new instance of RunnerInstructions.
- #install_script ⇒ Object
- #register_command ⇒ Object
Methods included from Allowable
Constructor Details
#initialize(os:, arch:) ⇒ RunnerInstructions
Returns a new instance of RunnerInstructions.
58 59 60 61 62 63 64 |
# File 'lib/gitlab/ci/runner_instructions.rb', line 58 def initialize(os:, arch:) @os = os @arch = arch @errors = [] validate_params end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
56 57 58 |
# File 'lib/gitlab/ci/runner_instructions.rb', line 56 def errors @errors end |
Instance Method Details
#install_script ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/gitlab/ci/runner_instructions.rb', line 66 def install_script with_error_handling [Gitlab::Ci::RunnerInstructions::ArgumentError] do raise Gitlab::Ci::RunnerInstructions::ArgumentError, _('Architecture not found for OS') unless environment[:download_locations].key?(@arch.to_sym) replace_variables(get_file(environment[:install_script_template_path])) end end |
#register_command ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gitlab/ci/runner_instructions.rb', line 74 def register_command with_error_handling [Gitlab::Ci::RunnerInstructions::ArgumentError, Gitlab::Access::AccessDeniedError] do raise Gitlab::Ci::RunnerInstructions::ArgumentError, _('No runner executable') unless environment[:runner_executable] server_url = Gitlab::Routing.url_helpers.root_url(only_path: false) runner_executable = environment[:runner_executable] "#{runner_executable} register --url #{server_url} --registration-token $REGISTRATION_TOKEN" end end |