Class: CIRunner::Check::Step

Inherits:
Struct
  • Object
show all
Defined in:
lib/ci_runner/check/circle_ci.rb

Overview

A Step object represents a CircleCI step. This Struct has eql? and hash implemented in order to check if two steps are the same and remove the duplicates.

Two steps are considered the same if their names are equal and both are successful. The reason this is implemented like this is to avoid downloading too many of the same logfiles.

Project on CircleCI can be configured to run in parallel, the number of steps and therefore log output we have to download increases exponentially.

As an example, imagine this CircleCI configuration:

‘Minitest’:

executor: ruby/default
parallelism: 16
steps:
  - setup-ruby
  - bundle install
  - bin/rails test

CircleCI will create 48 steps (and 48 log download link). Downloading those 48 log, don’t make sense since they will be all similar. Unless they failed, in which case we download the log for that step.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#failedObject

Returns the value of attribute failed

Returns:

  • (Object)

    the current value of failed



34
35
36
# File 'lib/ci_runner/check/circle_ci.rb', line 34

def failed
  @failed
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



34
35
36
# File 'lib/ci_runner/check/circle_ci.rb', line 34

def name
  @name
end

#output_urlObject

Returns the value of attribute output_url

Returns:

  • (Object)

    the current value of output_url



34
35
36
# File 'lib/ci_runner/check/circle_ci.rb', line 34

def output_url
  @output_url
end

Instance Method Details

#eql?(other) ⇒ Boolean

Used in conjuction with hash for unique comparison.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


40
41
42
43
44
# File 'lib/ci_runner/check/circle_ci.rb', line 40

def eql?(other)
  return false if failed || other.failed

  name == other.name
end

#hashString

Used for unique comparison.

Returns:

  • (String)


49
50
51
# File 'lib/ci_runner/check/circle_ci.rb', line 49

def hash
  [self.class, name, failed].hash
end