Class: Gitlab::Ci::Build::Rules::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/gitlab/ci/build/rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allow_failureObject

Returns the value of attribute allow_failure

Returns:

  • (Object)

    the current value of allow_failure



9
10
11
# File 'lib/gitlab/ci/build/rules.rb', line 9

def allow_failure
  @allow_failure
end

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



9
10
11
# File 'lib/gitlab/ci/build/rules.rb', line 9

def errors
  @errors
end

#needsObject

Returns the value of attribute needs

Returns:

  • (Object)

    the current value of needs



9
10
11
# File 'lib/gitlab/ci/build/rules.rb', line 9

def needs
  @needs
end

#start_inObject

Returns the value of attribute start_in

Returns:

  • (Object)

    the current value of start_in



9
10
11
# File 'lib/gitlab/ci/build/rules.rb', line 9

def start_in
  @start_in
end

#variablesObject

Returns the value of attribute variables

Returns:

  • (Object)

    the current value of variables



9
10
11
# File 'lib/gitlab/ci/build/rules.rb', line 9

def variables
  @variables
end

#whenObject

Returns the value of attribute when

Returns:

  • (Object)

    the current value of when



9
10
11
# File 'lib/gitlab/ci/build/rules.rb', line 9

def when
  @when
end

Instance Method Details

#build_attributesObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/ci/build/rules.rb', line 10

def build_attributes
  needs_job = needs&.dig(:job)
  {
    when: self.when,
    options: { start_in: start_in }.compact,
    allow_failure: allow_failure,
    scheduling_type: (:dag if needs_job.present?),
    needs_attributes: needs_job
  }.compact
end

#pass?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/gitlab/ci/build/rules.rb', line 21

def pass?
  self.when != 'never'
end