Class: CIRunner::Check::CircleCI
- Includes:
- ConcurrentDownload
- Defined in:
- lib/ci_runner/check/circle_ci.rb
Overview
Check class used when a project is configured to run its CI using CircleCI.
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 CI build.
-
#initialize(*args, url) ⇒ CircleCI
constructor
A new instance of CircleCI.
-
#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) ⇒ CircleCI
Returns a new instance of CircleCI.
62 63 64 65 66 |
# File 'lib/ci_runner/check/circle_ci.rb', line 62 def initialize(*args, url) super(*args) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
:private:
58 59 60 |
# File 'lib/ci_runner/check/circle_ci.rb', line 58 def url @url end |
Instance Method Details
#download_log ⇒ Tempfile
Download the CI logs for this CI build.
CircleCI doesn’t have an API to download a single log file for the whole build. Instead, we have to download a log output for each steps. Depending on the number of steps configured on a project, and whether it uses parallelism, the number of log files to download might be quite important.
The log for each steps are small in size, so downloading them in parallel to make things much faster.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ci_runner/check/circle_ci.rb', line 84 def download_log client = Client::CircleCI.new(Configuration::User.instance.circle_ci_token) job = client.job(repository, build_number) steps = [] job["steps"].each do |step| step["actions"].each do |parallel| next unless parallel["has_output"] steps << Step.new(*parallel.values_at("name", "output_url", "failed")) end end steps.uniq! steps.each do |step| @queue << step end process_queue end |
#provider ⇒ String
Used to tell the user which CI provider we are downloading the log output from.
71 72 73 |
# File 'lib/ci_runner/check/circle_ci.rb', line 71 def provider "CircleCI" end |