Class: Stax::Aws::Codebuild

Inherits:
Sdk
  • Object
show all
Defined in:
lib/stax/aws/codebuild.rb

Constant Summary

Constants inherited from Sdk

Sdk::RETRY_LIMIT

Class Method Summary collapse

Methods inherited from Sdk

paginate

Class Method Details

.builds(ids) ⇒ Object



31
32
33
# File 'lib/stax/aws/codebuild.rb', line 31

def builds(ids)
  client.batch_get_builds(ids: ids).builds
end

.builds_for_project(name, num = 100) ⇒ Object

returns ids of num most recent builds for project



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stax/aws/codebuild.rb', line 18

def builds_for_project(name, num = 100)
  count = 0
  next_token = nil
  builds = []
  loop do
    r = client.list_builds_for_project(project_name: name, next_token: next_token)
    builds += r.ids
    break if (count += r.ids.count) >= num
    break if (next_token = r.next_token).nil?
  end
  builds.first(num)
end

.clientObject



9
10
11
# File 'lib/stax/aws/codebuild.rb', line 9

def client
  @_client ||= ::Aws::CodeBuild::Client.new
end

.projects(names) ⇒ Object



13
14
15
# File 'lib/stax/aws/codebuild.rb', line 13

def projects(names)
  client.batch_get_projects(names: names).projects
end

.reports(arns) ⇒ Object



35
36
37
# File 'lib/stax/aws/codebuild.rb', line 35

def reports(arns)
  client.batch_get_reports(report_arns: arns).reports
end

.start(opt) ⇒ Object



44
45
46
# File 'lib/stax/aws/codebuild.rb', line 44

def start(opt)
  client.start_build(opt).build
end

.tests(arn) ⇒ Object

TODO: this fails attempt to page as enumerable, check back with sdk v3



40
41
42
# File 'lib/stax/aws/codebuild.rb', line 40

def tests(arn)
  client.describe_test_cases(report_arn: arn).test_cases
end