Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Updates to build locators (e.g. "number=1.0.0.9999,branch:(default:any)") #43

Open
mikeclayton opened this issue Mar 26, 2013 · 0 comments

Comments

@mikeclayton
Copy link

Hi,

At the moment if you use a BuildLocator to find a build by id or number you can't also specify additional dimensions like "branch:(default:any)" to look in non-default branches. This was causing me a problem so I've made some changes to allow locating builds by id or number and dimensions at the same time:

  • a new BranchLocator class that wraps the "branch locator" spec in the TeamCity REST API - e.g. "(name:name,default:true/false/any,unspecified:true/false/any,branched:true/false/any)"
  • allow build locators to specify dimensions in addition to id or number - e.g. "number:1.0.0.9999,buildType:(name:My CI Build),status:SUCCESS,branch:(default:any)"
  • additional Locator classes that implement Fluid methods for each property. No more BuildLocator::WithDimensions($null, $null, $null, $null, $null, $null, $null, 100, 50, $null, $null, $null, $null) in PowerShell to specify maxResults and startIndex - just use (new-object FluidBuildLocator).WithMaxResults(100).WithStartIndex(50) instead.
  • added a load of unit tests to check string generation for Locators.

Example (in PowerShell):

$branchLocator = (new-object TeamCitySharp.Locators.FluidBranchLocator).WithDefault("Any");

$buildTypeLocator = [TeamCitySharp.Locators.FluidBuildTypeLocator]::WithName($buildTypeName);

$buildLocator = [TeamCitySharp.Locators.FluidBuildLocator]::WithNumber($buildNumber).WithBuildType(
$buildTypeLocator).WithBranch($branchLocator).WithStatus("SUCCESS");

$builds = $tcClient.Builds.ByBuildLocator($buildLocator);

Cheers,

Mike

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant