Class: Gitlab::Ci::Build::Step
- Inherits:
-
Object
- Object
- Gitlab::Ci::Build::Step
- Defined in:
- lib/gitlab/ci/build/step.rb
Constant Summary collapse
- WHEN_ON_FAILURE =
'on_failure'
- WHEN_ON_SUCCESS =
'on_success'
- WHEN_ALWAYS =
'always'
Instance Attribute Summary collapse
-
#allow_failure ⇒ Object
Returns the value of attribute allow_failure.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#script ⇒ Object
Returns the value of attribute script.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#when ⇒ Object
Returns the value of attribute when.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Step
constructor
A new instance of Step.
Constructor Details
#initialize(name) ⇒ Step
Returns a new instance of Step.
47 48 49 50 |
# File 'lib/gitlab/ci/build/step.rb', line 47 def initialize(name) @name = name @allow_failure = false end |
Instance Attribute Details
#allow_failure ⇒ Object
Returns the value of attribute allow_failure.
12 13 14 |
# File 'lib/gitlab/ci/build/step.rb', line 12 def allow_failure @allow_failure end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/gitlab/ci/build/step.rb', line 11 def name @name end |
#script ⇒ Object
Returns the value of attribute script.
12 13 14 |
# File 'lib/gitlab/ci/build/step.rb', line 12 def script @script end |
#timeout ⇒ Object
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/gitlab/ci/build/step.rb', line 12 def timeout @timeout end |
#when ⇒ Object
Returns the value of attribute when.
12 13 14 |
# File 'lib/gitlab/ci/build/step.rb', line 12 def when @when end |
Class Method Details
.from_after_script(job) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gitlab/ci/build/step.rb', line 34 def from_after_script(job) after_script = job.[:after_script] return unless after_script self.new(:after_script).tap do |step| step.script = after_script step.timeout = job. step.when = WHEN_ALWAYS step.allow_failure = true end end |
.from_commands(job) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/gitlab/ci/build/step.rb', line 15 def from_commands(job) self.new(:script).tap do |step| step.script = job.[:before_script].to_a + job.[:script].to_a step.timeout = job. step.when = WHEN_ON_SUCCESS end end |
.from_release(job) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/ci/build/step.rb', line 23 def from_release(job) release = job.[:release] return unless release self.new(:release).tap do |step| step.script = Gitlab::Ci::Build::Releaser.new(config: job.[:release]).script step.timeout = job. step.when = WHEN_ON_SUCCESS end end |