Class: CIRunner::Client::Buildkite
- Defined in:
- lib/ci_runner/client/buildkite.rb
Overview
Client used for public Buildkite resources. Allow any users to download log output for builds that are in organizations they are not a member of.
This client doesn’t use the official buildkite API. The data returned are not exactly the same.
Constant Summary collapse
- API_ENDPOINT =
"buildkite.com"
Instance Method Summary collapse
-
#download_log(path) ⇒ Tempfile, IO
Download raw log output for a job.
-
#job_logs(org, pipeline, build_number) ⇒ Array<String>
Retrieve URL paths to download job logs for all steps.
-
#public_build?(org, pipeline, build_number) ⇒ Boolean
Check if the build is public and can be accessed without authentication.
Methods inherited from Base
default_client, #initialize, #reset!
Constructor Details
This class inherits a constructor from CIRunner::Client::Base
Instance Method Details
#download_log(path) ⇒ Tempfile, IO
Download raw log output for a job.
53 54 55 56 57 |
# File 'lib/ci_runner/client/buildkite.rb', line 53 def download_log(path) redirection_url = get(path) URI.open(redirection_url) end |
#job_logs(org, pipeline, build_number) ⇒ Array<String>
Retrieve URL paths to download job logs for all steps.
40 41 42 43 44 45 46 |
# File 'lib/ci_runner/client/buildkite.rb', line 40 def job_logs(org, pipeline, build_number) @build ||= get("/#{org}/#{pipeline}/builds/#{build_number}") @build["jobs"].map do |job| job["base_path"] + "/raw_log" end end |
#public_build?(org, pipeline, build_number) ⇒ Boolean
Check if the build is public and can be accessed without authentication.
23 24 25 26 27 28 29 30 31 |
# File 'lib/ci_runner/client/buildkite.rb', line 23 def public_build?(org, pipeline, build_number) job_logs(org, pipeline, build_number) true rescue Error => e return false if e.error_code == 403 raise(e) end |