Class: Jenkins::Model::Build
- Inherits:
-
Object
- Object
- Jenkins::Model::Build
- Defined in:
- lib/jenkins/model/build.rb
Overview
Represents a single build. In general, you won’t need this
Defined Under Namespace
Classes: Halt
Instance Attribute Summary collapse
-
#native ⇒ Object
readonly
the Hudson::Model::AbstractBuild represented by this build.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Gets a build value.
-
#[]=(key, value) ⇒ Object
Sets a build value.
-
#abort(reason = nil) ⇒ Object
Abort the current build, causing a build failure.
- #build_var ⇒ Object
- #build_wrapper_environment(cls) ⇒ Object
- #env ⇒ Object
-
#halt(reason = nil) ⇒ Object
Halt the current build, without setting the result to failure.
-
#initialize(native = nil) ⇒ Build
constructor
A new instance of Build.
- #workspace ⇒ Object
Constructor Details
#initialize(native = nil) ⇒ Build
Returns a new instance of Build.
19 20 21 22 |
# File 'lib/jenkins/model/build.rb', line 19 def initialize(native = nil) @native = native @variables = {} end |
Instance Attribute Details
#native ⇒ Object (readonly)
the Hudson::Model::AbstractBuild represented by this build
17 18 19 |
# File 'lib/jenkins/model/build.rb', line 17 def native @native end |
Instance Method Details
#[](key) ⇒ Object
Gets a build value. Each build stores a map of key,value pairs which can be used by each build step in the pipeline
29 30 31 |
# File 'lib/jenkins/model/build.rb', line 29 def [](key) @variables[key.to_s] end |
#[]=(key, value) ⇒ Object
Sets a build value. Each build has a map of key,value pairs which allow build steps to share information
39 40 41 |
# File 'lib/jenkins/model/build.rb', line 39 def []=(key, value) @variables[key.to_s] = value end |
#abort(reason = nil) ⇒ Object
Abort the current build, causing a build failure.
57 58 59 |
# File 'lib/jenkins/model/build.rb', line 57 def abort(reason = nil) raise Java.hudson.AbortException.new(reason) end |
#build_var ⇒ Object
61 62 63 |
# File 'lib/jenkins/model/build.rb', line 61 def build_var @native.getBuildVariables() end |
#build_wrapper_environment(cls) ⇒ Object
69 70 71 72 73 |
# File 'lib/jenkins/model/build.rb', line 69 def build_wrapper_environment(cls) @native.getEnvironmentList().find do |e| e.instance_of?(Jenkins::Plugin::Proxies::EnvironmentWrapper) && e.build_wrapper.instance_of?(cls) end end |
#env ⇒ Object
65 66 67 |
# File 'lib/jenkins/model/build.rb', line 65 def env @native.getEnvironment(nil) end |
#halt(reason = nil) ⇒ Object
Halt the current build, without setting the result to failure
50 51 52 |
# File 'lib/jenkins/model/build.rb', line 50 def halt(reason = nil) raise Halt, reason end |