Module: Gitlab::CI::Client::Builds

Included in:
Gitlab::CI::Client
Defined in:
lib/gitlab/ci/client/builds.rb

Overview

Defines methods related to builds.

Instance Method Summary collapse

Instance Method Details

#register_build(token) ⇒ Array<Gitlab::ObjectifiedHash>

Runs oldest pending build by runner

Examples:

Gitlab.register_build('7a14d63e4b1af83171f4eb3d4a5246')

Parameters:

  • token (String)

    (required) - The unique token of runner

Returns:

  • (Array<Gitlab::ObjectifiedHash>)


12
13
14
# File 'lib/gitlab/ci/client/builds.rb', line 12

def register_build(token)
  post("/builds/register", body: { token: token })
end

#update_build(id, state = nil, trace = nil) ⇒ Gitlab::ObjectifiedHash

Update details of an existing build

Examples:

Gitlab.update_build(5)

Parameters:

  • id (Integer, String)

    (required) - The ID of a project

  • state (String) (defaults to: nil)

    (optional) - The state of a build

  • trace (String) (defaults to: nil)

    (optional) - The trace of a build

Returns:

  • (Gitlab::ObjectifiedHash)


25
26
27
28
29
30
31
# File 'lib/gitlab/ci/client/builds.rb', line 25

def update_build(id, state=nil, trace=nil)
  if state or trace
    put("/builds/#{id}", body: { state: state, trace: trace })
			else
"{}"
  end
end