Our existing batch build script contains an URL to get the latest product-build (of another build definition) from.
How can one access the lattest build drop folder of TFS Team Build?
I'm looking for something to access the latest \buildserver\builddrop\Project-2010MMDD.N\
By default, the artifacts are stored under the <TeamCity Data Directory\>/system/artifacts directory which can be changed. You can configure an external artifacts storage to replace the built-in one. Build artifacts can also be uploaded to the server while the build is still running.
A release is a collection of artifacts in your DevOps CI/CD processes. An artifact is a deployable component of your application. Azure Pipelines can deploy artifacts that are produced by a wide range of artifact sources, and stored in different types of artifact repositories.
A DevOps artifact is a by-product produced during the software development process. It may consist of the project source code, dependencies, binaries or resources, and could be represented in different layout depending on the technology.
Using the API, you can get the drop location from the build. The code below gets the most recent build for a given project, and returns the dropfolder.
public string DropFolder(TeamFoundationServer tfs, string teamProject, string buildName)
{
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
IBuildDetailSpec buildDetailSpec = buildServer.CreateBuildDetailSpec(teamProject, buildName);
buildDetailSpec.MaxBuildsPerDefinition = 1;
buildDetailSpec.QueryOrder = BuildQueryOrder.FinishTimeDescending;
buildDetailSpec.Status = BuildStatus.Failed | BuildStatus.PartiallySucceeded | BuildStatus.Stopped | BuildStatus.Succeeded;
IBuildQueryResult results = buildServer.QueryBuilds(buildDetailSpec);
if (results.Failures.Length != 0)
{
throw new ApplicationException("this needs to go away and be handled more nicely");
}
if (results.Builds.Length == 1)
{
results.Builds[0].DropLocation;
}
else
{
return null;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With