Class: Buildkite::Build
- Inherits:
-
Object
- Object
- OpenStruct
- Object
- Buildkite::Build
show all
- Defined in:
- lib/buildkite/models/build.rb
Class Method Summary
collapse
-
.cancel(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:) ⇒ Object
-
.create(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, commit:, branch:, **args) ⇒ Object
-
.list(org: nil, pipeline: nil) ⇒ Object
-
.rebuild(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:) ⇒ Object
-
.retrieve(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:) ⇒ Object
Methods inherited from Object
#initialize, #to_ostruct
Class Method Details
.cancel(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:) ⇒ Object
31
32
33
34
|
# File 'lib/buildkite/models/build.rb', line 31
def cancel(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:)
response = Client.put_request("organizations/#{org}/pipelines/#{pipeline}/builds/#{number}/cancel", body: {})
Build.new response.body
end
|
.create(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, commit:, branch:, **args) ⇒ Object
25
26
27
28
29
|
# File 'lib/buildkite/models/build.rb', line 25
def create(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, commit:, branch:, **args)
data = {commit: commit, branch: branch}
response = Client.post_request("organizations/#{org}/pipelines/#{pipeline}/builds", body: data.merge(args))
Build.new response.body
end
|
.list(org: nil, pipeline: nil) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/buildkite/models/build.rb', line 6
def list(org: nil, pipeline: nil)
if org && pipeline
response = Client.get_request("organizations/#{org}/pipelines/#{pipeline}/builds")
elsif org
response = Client.get_request("organizations/#{org}/builds")
else
response = Client.get_request("builds")
end
if response
Collection.from_response(response, type: Build)
end
end
|
.rebuild(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:) ⇒ Object
36
37
38
39
|
# File 'lib/buildkite/models/build.rb', line 36
def rebuild(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:)
response = Client.put_request("organizations/#{org}/pipelines/#{pipeline}/builds/#{number}/rebuild", body: {})
Build.new response.body
end
|
.retrieve(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, number:) ⇒ Object