Module: TeamCity::Client::BuildTypes
- Included in:
- TeamCity::Client
- Defined in:
- lib/teamcity/client/build_types.rb
Overview
Defines methods related to build types (or build configurations)
Instance Method Summary collapse
-
#attach_vcs_root(buildtype_id, vcs_root_id) ⇒ Hashie::Mash
Attach a vcs root to a build type (build configuration_).
-
#buildtype(options = {}) ⇒ Hashie::Mash
Get build configuration details.
-
#buildtype_agent_requirements(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration agent_requirements.
-
#buildtype_artifact_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration artifact_dependencies.
-
#buildtype_features(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration features.
-
#buildtype_investigations(buildtype_id) ⇒ Array<Hashie::Mash>
Get investigation info for build configuration.
-
#buildtype_parameters(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration parameters.
-
#buildtype_settings(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration settings.
-
#buildtype_snapshot_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration snapshot_dependencies.
-
#buildtype_state(options = {}) ⇒ String
Get whether the build is paused or not.
-
#buildtype_steps(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration steps.
-
#buildtype_template(options = {}) ⇒ Hashie::Mash?
Get template associated with build configuration.
-
#buildtype_triggers(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration triggers.
-
#buildtype_vcs_root_entries(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration vcs_root_entries.
-
#buildtypes ⇒ Array<Hashie::Mash>?
List of build types.
-
#create_agent_requirement(buildtype_id, parameter_name, parameter_value, condition) ⇒ Hashie::Mash
Create a buildtype agent requirement (Create).
-
#create_build_step(buildtype_id, options = {}) {|Hash| ... } ⇒ Hashie::Mash
Create Build Step.
-
#create_build_trigger(buildtype_id, options = {}) {|Hash| ... } ⇒ Hashie::Mash
Create Build Trigger.
-
#create_buildtype(project_id, name) ⇒ Hashie::Mash
Create a Build Configuration.
-
#delete_agent_requirement(buildtype_id, parameter_name) ⇒ nil
Delete an agent requirement for a buildtype.
-
#delete_buildtype(buildtype_id) ⇒ nil
Delete buildtype (build configuration).
-
#delete_buildtype_parameter(buildtype_id, parameter_name) ⇒ nil
Delete a buildtype parameter.
-
#set_build_step_field(buildtype_id, step_id, field_name, field_value) ⇒ nil
Set build step field.
-
#set_buildtype_field(buildtype_id, field_name, field_value) ⇒ Object
Set a buildtype field.
-
#set_buildtype_parameter(buildtype_id, parameter_name, parameter_value) ⇒ Object
Set a buildtype parameter (Create or Update).
-
#set_buildtype_setting(buildtype_id, setting_name, setting_value) ⇒ Object
Set buildtype settings.
Instance Method Details
#attach_vcs_root(buildtype_id, vcs_root_id) ⇒ Hashie::Mash
Attach a vcs root to a build type (build configuration_)
117 118 119 120 121 122 123 |
# File 'lib/teamcity/client/build_types.rb', line 117 def attach_vcs_root(buildtype_id, vcs_root_id) payload = { 'vcs-root' => { :id => vcs_root_id } } post("buildTypes/#{buildtype_id}/vcs-root-entries", :content_type => :json) do |req| req.body = payload.to_json end end |
#buildtype(options = {}) ⇒ Hashie::Mash
Get build configuration details
19 20 21 22 |
# File 'lib/teamcity/client/build_types.rb', line 19 def buildtype(={}) () get("buildTypes/#{locator()}") end |
#buildtype_agent_requirements(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration agent_requirements
106 |
# File 'lib/teamcity/client/build_types.rb', line 106 make_method :agent_requirements |
#buildtype_artifact_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration artifact_dependencies
107 |
# File 'lib/teamcity/client/build_types.rb', line 107 make_method :artifact_dependencies |
#buildtype_features(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration features
103 |
# File 'lib/teamcity/client/build_types.rb', line 103 make_method :features |
#buildtype_investigations(buildtype_id) ⇒ Array<Hashie::Mash>
Get investigation info for build configuration
69 70 71 72 |
# File 'lib/teamcity/client/build_types.rb', line 69 def buildtype_investigations(buildtype_id) response = get("buildTypes/#{buildtype_id}/investigations") response['investigation'] end |
#buildtype_parameters(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration parameters
59 60 61 62 63 |
# File 'lib/teamcity/client/build_types.rb', line 59 def buildtype_parameters(={}) () response = get("buildTypes/#{locator()}/parameters") response['property'] end |
#buildtype_settings(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration settings
49 50 51 52 53 |
# File 'lib/teamcity/client/build_types.rb', line 49 def buildtype_settings(={}) () response = get("buildTypes/#{locator()}/settings") response['property'] end |
#buildtype_snapshot_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration snapshot_dependencies
108 |
# File 'lib/teamcity/client/build_types.rb', line 108 make_method :snapshot_dependencies |
#buildtype_state(options = {}) ⇒ String
Get whether the build is paused or not
39 40 41 42 43 |
# File 'lib/teamcity/client/build_types.rb', line 39 def buildtype_state(={}) () path = "buildTypes/#{locator()}/paused" get(path, :accept => :text, :content_type => :text) end |
#buildtype_steps(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration steps
105 |
# File 'lib/teamcity/client/build_types.rb', line 105 make_method :steps |
#buildtype_template(options = {}) ⇒ Hashie::Mash?
Get template associated with build configuration
78 79 80 81 82 83 84 85 |
# File 'lib/teamcity/client/build_types.rb', line 78 def buildtype_template(={}) () begin get("buildTypes/#{locator()}/template") rescue StandardError => e /No template associated/.match(e.to_s) ? nil : raise end end |
#buildtype_triggers(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration triggers
104 |
# File 'lib/teamcity/client/build_types.rb', line 104 make_method :triggers |
#buildtype_vcs_root_entries(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration vcs_root_entries
109 |
# File 'lib/teamcity/client/build_types.rb', line 109 make_method :vcs_root_entries |
#buildtypes ⇒ Array<Hashie::Mash>?
List of build types
10 11 12 13 |
# File 'lib/teamcity/client/build_types.rb', line 10 def buildtypes response = get('buildTypes') response['buildType'] end |
#create_agent_requirement(buildtype_id, parameter_name, parameter_value, condition) ⇒ Hashie::Mash
Check the TeamCity UI for supported conditions
Create a buildtype agent requirement (Create)
161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/teamcity/client/build_types.rb', line 161 def create_agent_requirement(buildtype_id, parameter_name, parameter_value, condition) builder = TeamCity::ElementBuilder.new(:id => parameter_name, :type => condition) do |properties| properties['property-name'] = parameter_name properties['property-value'] = parameter_value end path = "buildTypes/#{buildtype_id}/agent-requirements" post(path, :accept => :json, :content_type => :json) do |req| req.body = builder.to_request_body end end |
#create_build_step(buildtype_id, options = {}) {|Hash| ... } ⇒ Hashie::Mash
Create Build Step
255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/teamcity/client/build_types.rb', line 255 def create_build_step(buildtype_id, = {}, &block) attributes = { :type => .fetch(:type), :name => .fetch(:name) { nil } } builder = TeamCity::ElementBuilder.new(attributes, &block) post("buildTypes/#{buildtype_id}/steps", :content_type => :json) do |req| req.body = builder.to_request_body end end |
#create_build_trigger(buildtype_id, options = {}) {|Hash| ... } ⇒ Hashie::Mash
Create Build Trigger
281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/teamcity/client/build_types.rb', line 281 def create_build_trigger(buildtype_id, = {}, &block) attributes = { :type => .fetch(:type), } builder = TeamCity::ElementBuilder.new(attributes, &block) post("buildTypes/#{buildtype_id}/triggers", :content_type => :json) do |req| req.body = builder.to_request_body end end |
#create_buildtype(project_id, name) ⇒ Hashie::Mash
Create a Build Configuration
29 30 31 32 33 |
# File 'lib/teamcity/client/build_types.rb', line 29 def create_buildtype(project_id, name) post("projects/#{project_id}/buildTypes", :content_type => :text) do |req| req.body = name end end |
#delete_agent_requirement(buildtype_id, parameter_name) ⇒ nil
Delete an agent requirement for a buildtype
178 179 180 |
# File 'lib/teamcity/client/build_types.rb', line 178 def delete_agent_requirement(buildtype_id, parameter_name) delete("buildTypes/#{buildtype_id}/agent-requirements/#{parameter_name}") end |
#delete_buildtype(buildtype_id) ⇒ nil
Delete buildtype (build configuration)
223 224 225 |
# File 'lib/teamcity/client/build_types.rb', line 223 def delete_buildtype(buildtype_id) delete("buildTypes/#{buildtype_id}") end |
#delete_buildtype_parameter(buildtype_id, parameter_name) ⇒ nil
Delete a buildtype parameter
144 145 146 147 |
# File 'lib/teamcity/client/build_types.rb', line 144 def delete_buildtype_parameter(buildtype_id, parameter_name) path = "buildTypes/#{buildtype_id}/parameters/#{parameter_name}" delete(path, :accept => :text, :content_type => :text) end |
#set_build_step_field(buildtype_id, step_id, field_name, field_value) ⇒ nil
Set build step field
234 235 236 237 238 239 |
# File 'lib/teamcity/client/build_types.rb', line 234 def set_build_step_field(buildtype_id, step_id, field_name, field_value) path = "buildTypes/#{buildtype_id}/steps/#{step_id}/#{field_name}" put(path, :accept => :text, :content_type => :text) do |req| req.body = field_value end end |
#set_buildtype_field(buildtype_id, field_name, field_value) ⇒ Object
Set a buildtype field
195 196 197 198 199 200 |
# File 'lib/teamcity/client/build_types.rb', line 195 def set_buildtype_field(buildtype_id, field_name, field_value) path = "buildTypes/#{buildtype_id}/#{field_name}" put(path, :accept => :text, :content_type => :text) do |req| req.body = field_value end end |
#set_buildtype_parameter(buildtype_id, parameter_name, parameter_value) ⇒ Object
Set a buildtype parameter (Create or Update)
132 133 134 135 136 137 |
# File 'lib/teamcity/client/build_types.rb', line 132 def set_buildtype_parameter(buildtype_id, parameter_name, parameter_value) path = "buildTypes/#{buildtype_id}/parameters/#{parameter_name}" put(path, :accept => :text, :content_type => :text) do |req| req.body = parameter_value end end |
#set_buildtype_setting(buildtype_id, setting_name, setting_value) ⇒ Object
Set buildtype settings
215 216 217 |
# File 'lib/teamcity/client/build_types.rb', line 215 def set_buildtype_setting(buildtype_id, setting_name, setting_value) set_buildtype_field(buildtype_id, "settings/#{setting_name}", setting_value) end |