Class: CIRunner::Check::Buildkite
- Includes:
- ConcurrentDownload
- Defined in:
- lib/ci_runner/check/buildkite.rb
Overview
Check class used when a project is configured to run its CI using Buildkite.
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
:private:.
Attributes inherited from Base
#commit, #name, #repository, #status
Instance Method Summary collapse
-
#download_log ⇒ Tempfile
Download the CI logs for this Buildkite build.
-
#initialize(*args, url) ⇒ Buildkite
constructor
A new instance of Buildkite.
-
#provider ⇒ String
Used to tell the user which CI provider we are downloading the log output from.
Methods inherited from Base
Constructor Details
#initialize(*args, url) ⇒ Buildkite
Returns a new instance of Buildkite.
16 17 18 19 20 |
# File 'lib/ci_runner/check/buildkite.rb', line 16 def initialize(*args, url) super(*args) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
:private:
12 13 14 |
# File 'lib/ci_runner/check/buildkite.rb', line 12 def url @url end |
Instance Method Details
#download_log ⇒ Tempfile
Download the CI logs for this Buildkite build.
The Buildkite API scopes tokens per organizations (token generated for org A can’t access resource on org B, even for public resources). This means that for opensource projects using Buildkite, users that are not members of the buildkite org normally can’t use CI Runner.
To bypass this problem, for builds that are public, CI Runner uses a different API. For private build, CI runner will check if the user had stored a Buildkite token in its config.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ci_runner/check/buildkite.rb', line 39 def download_log uri = URI(url) _, org, pipeline, _, build = uri.path.split("/") @client = Client::Buildkite.new unless @client.public_build?(org, pipeline, build) token = retrieve_token_from_config(org, url) @client = Client::AuthenticatedBuildkite.new(token) end @client.job_logs(org, pipeline, build).each do |log_url| @queue << log_url end process_queue end |
#provider ⇒ String
Used to tell the user which CI provider we are downloading the log output from.
25 26 27 |
# File 'lib/ci_runner/check/buildkite.rb', line 25 def provider "Buildkite" end |