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_branches(buildtype_id) ⇒ Array<Hashie::Mash>
Get a listing of vcs branches.
-
#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_)
127 128 129 130 131 132 133 |
# File 'lib/teamcity/client/build_types.rb', line 127 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
116 |
# File 'lib/teamcity/client/build_types.rb', line 116 make_method :agent_requirements |
#buildtype_artifact_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration artifact_dependencies
117 |
# File 'lib/teamcity/client/build_types.rb', line 117 make_method :artifact_dependencies |
#buildtype_branches(buildtype_id) ⇒ Array<Hashie::Mash>
Get a listing of vcs branches
39 40 41 42 43 |
# File 'lib/teamcity/client/build_types.rb', line 39 def buildtype_branches(buildtype_id) path = "buildTypes/#{buildtype_id}/branches" response = get(path, :accept => :json, :content_type => :json) response.branch end |
#buildtype_features(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration features
113 |
# File 'lib/teamcity/client/build_types.rb', line 113 make_method :features |
#buildtype_investigations(buildtype_id) ⇒ Array<Hashie::Mash>
Get investigation info for build configuration
79 80 81 82 |
# File 'lib/teamcity/client/build_types.rb', line 79 def buildtype_investigations(buildtype_id) response = get("buildTypes/#{buildtype_id}/investigations") response['investigation'] end |
#buildtype_parameters(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration parameters
69 70 71 72 73 |
# File 'lib/teamcity/client/build_types.rb', line 69 def buildtype_parameters(={}) () response = get("buildTypes/#{locator()}/parameters") response['property'] end |
#buildtype_settings(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration settings
59 60 61 62 63 |
# File 'lib/teamcity/client/build_types.rb', line 59 def buildtype_settings(={}) () response = get("buildTypes/#{locator()}/settings") response['property'] end |
#buildtype_snapshot_dependencies(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration snapshot_dependencies
118 |
# File 'lib/teamcity/client/build_types.rb', line 118 make_method :snapshot_dependencies |
#buildtype_state(options = {}) ⇒ String
Get whether the build is paused or not
49 50 51 52 53 |
# File 'lib/teamcity/client/build_types.rb', line 49 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
115 |
# File 'lib/teamcity/client/build_types.rb', line 115 make_method :steps |
#buildtype_template(options = {}) ⇒ Hashie::Mash?
Get template associated with build configuration
88 89 90 91 92 93 94 95 |
# File 'lib/teamcity/client/build_types.rb', line 88 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
114 |
# File 'lib/teamcity/client/build_types.rb', line 114 make_method :triggers |
#buildtype_vcs_root_entries(options = {}) ⇒ Array<Hashie::Mash>
Get build configuration vcs_root_entries
119 |
# File 'lib/teamcity/client/build_types.rb', line 119 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)
172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/teamcity/client/build_types.rb', line 172 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
266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/teamcity/client/build_types.rb', line 266 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
292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/teamcity/client/build_types.rb', line 292 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
189 190 191 |
# File 'lib/teamcity/client/build_types.rb', line 189 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)
234 235 236 |
# File 'lib/teamcity/client/build_types.rb', line 234 def delete_buildtype(buildtype_id) delete("buildTypes/#{buildtype_id}") end |
#delete_buildtype_parameter(buildtype_id, parameter_name) ⇒ nil
Delete a buildtype parameter
154 155 156 157 158 |
# File 'lib/teamcity/client/build_types.rb', line 154 def delete_buildtype_parameter(buildtype_id, parameter_name) path = "buildTypes/#{buildtype_id}/parameters/#{parameter_name}" delete(path, :accept => :text, :content_type => :text) return nil end |
#set_build_step_field(buildtype_id, step_id, field_name, field_value) ⇒ nil
Set build step field
245 246 247 248 249 250 |
# File 'lib/teamcity/client/build_types.rb', line 245 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
206 207 208 209 210 211 |
# File 'lib/teamcity/client/build_types.rb', line 206 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)
142 143 144 145 146 147 |
# File 'lib/teamcity/client/build_types.rb', line 142 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
226 227 228 |
# File 'lib/teamcity/client/build_types.rb', line 226 def set_buildtype_setting(buildtype_id, setting_name, setting_value) set_buildtype_field(buildtype_id, "settings/#{setting_name}", setting_value) end |