Module: Gitlab::Client::Runners

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/runners.rb

Overview

Defines methods related to runners.

Instance Method Summary collapse

Instance Method Details

#all_runners(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.all_runners

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :scope (String)

    The scope of runners to show, one of: specific, shared, active, paused, online; showing all runners if none provided

Returns:



30
31
32
# File 'lib/gitlab/client/runners.rb', line 30

def all_runners(options = {})
  get("/runners/all", query: options)
end

#delete_runner(id) ⇒ Gitlab::ObjectifiedHash

Remove a runner. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.delete_runner(42)

Parameters:

  • id (Integer, String)

    The ID of a runner

Returns:



71
72
73
# File 'lib/gitlab/client/runners.rb', line 71

def delete_runner(id)
  delete("/runners/#{id}")
end

#project_disable_runner(id, runner_id) ⇒ Gitlab::ObjectifiedHash

Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.project_disable_runner(2, 42)

Parameters:

  • id (Integer, String)

    The ID of a project.

  • runner_id (Integer, String)

    The ID of a runner.

Returns:



110
111
112
# File 'lib/gitlab/client/runners.rb', line 110

def project_disable_runner(id, runner_id)
  delete("/projects/#{id}/runners/#{runner_id}")
end

#project_enable_runner(project_id, id) ⇒ Gitlab::ObjectifiedHash

Enable an available specific runner in the project. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.project_enable_runner(2, 42)

Parameters:

  • id (Integer, String)

    The ID of a project.

  • id (Integer, String)

    The ID of a runner.

Returns:



96
97
98
99
# File 'lib/gitlab/client/runners.rb', line 96

def project_enable_runner(project_id, id)
  body = { runner_id: id }
  post("/projects/#{project_id}/runners", body: body)
end

#project_runners(project_id) ⇒ Array<Gitlab::ObjectifiedHash>

List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.project_runners(42)

Parameters:

  • id (Integer, String)

    The ID of a project.

Returns:



83
84
85
# File 'lib/gitlab/client/runners.rb', line 83

def project_runners(project_id)
  get("/projects/#{project_id}/runners")
end

#runner(id) ⇒ Gitlab::ObjectifiedHash

Get details of a runner.. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.runner(42)

Parameters:

  • id (Integer, String)

    The ID of a runner

Returns:



42
43
44
# File 'lib/gitlab/client/runners.rb', line 42

def runner(id)
  get("/runners/#{id}")
end

#runners(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Get a list of specific runners available to the user. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.runners
Gitlab.runners(:active)
Gitlab.runners(:paused)

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :scope (String)

    The scope of specific runners to show, one of: active, paused, online; showing all runners if none provided

Returns:



17
18
19
# File 'lib/gitlab/client/runners.rb', line 17

def runners(options = {})
  get("/runners", query: options)
end

#update_runner(id, options = {}) ⇒ Gitlab::ObjectifiedHash

Update details of a runner. Full runner params documentation: github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md

Examples:

Gitlab.update_runner(42, { description: 'Awesome runner' })
Gitlab.update_runner(42, { active: false })
Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] })

Parameters:

  • id (Integer, String)

    The ID of a runner

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :active (String)

    The state of a runner; can be set to true or false.

  • :tag_list (String)

    The list of tags for a runner; put array of tags, that should be finally assigned to a runner

Returns:



59
60
61
# File 'lib/gitlab/client/runners.rb', line 59

def update_runner(id, options={})
  put("/runners/#{id}", query: options)
end