TFS 2010 跟踪构建中由门控签入导致的变更集的问题

发布于 2024-11-14 21:34:42 字数 883 浏览 4 评论 0原文

为了检索哪个变更集包含在哪个构建中,我们使用 Team Foundation Sidekicks 的“Label Sidekick”,其中我们将构建和更改集的标签放置在其中。期望找到新建的变更集。

我们在 TFS 2010 中的开发过程正在使用“门控”签入,因此我们面临着最新签入未在 Sidekicks 中呈现的情况(我们实际上收到了先前构建的变更集)。这是可以解释的,因为在进行标签时,最新的更改尚未提交。

BuildLog 确实正确报告了关联的变更集。

我在构建过程模板中进行了多次实验,但似乎无法得到我们需要的东西。 例如,将标签活动置于“在代理上运行”范围之外,会导致构建一开始就失败,并显示“对象引用未设置到对象的实例”。 (我想这与我必须扩大“标签”和“工作空间”变量的范围才能运行第二部分有关)。
此尝试的构建过程模板的“之前”状态位于此处(此有效),“之后”状态(“对象引用未设置..”)是 此处

因此,总而言之,两种不同类型的输入可以帮助我:

我应该如何更改我们的构建流程模板,以便在提交门控签入之后进行标记? (-- 这将使 Sidekicks 中的显示更加合理)

如何以编程方式检索每个构建的关联变更集? (-- 这将使我能够编写一个可以废弃 Sidekicks 角度的小应用程序)

In order to retrieve the information which Changeset was included in which Build, we use "Label Sidekick" of Team Foundation Sidekicks, where we place the Label of the Build & expect to find the newly built Changeset.

Our development process in TFS 2010 is making use of 'Gated' checkins, so we are faced with the situation that the latest checkins are not presented in Sidekicks (we actually receive the changeset of the previous build). This is explainable, since at the time the labeling takes place, the latest changes have not yet been committed.

The BuildLog does report the associated Changeset correctly.

I 've made several experiments in our Build Process Template but can't seem to get what we need.
Placing, for example, the Labeling activity out of the "Run On Agent" scope, lead me to a build that fails at the very start with an "Object reference not set to an instance of an object." (I suppose this is related with fact I had to widen the scope for 'Label' & 'Workspace' variables to get the second part running).
The 'before' state of the build process template for this attempt is here (this works), the 'after' state ("Object ref not set..") is here.

So, to summarize, two different types of input could help me out:

How should I change our build process template so that the labeling happens after the Gated checkins have been committed? (-- This would rationalize the display in Sidekicks)

or

How can I programmatically retrieve the associated Changeset of each Build? (-- This would enable me to write a small app that could obsolete the Sidekicks angle)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

友欢 2024-11-21 21:34:42

您可以使用 TFS API 来完成此操作。

        public static void GetBuild()
    {
        var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfsdevlonuk:8080/tfs/gazprom.mt"), new UICredentialsProvider());
        tfs.EnsureAuthenticated();
        var buildServer = tfs.GetService<IBuildServer>();

        // Get Project Name
        var versionControl = tfs.GetService<VersionControlServer>();
        var teamProjects = versionControl.GetAllTeamProjects(true);

        // Get Builds for a team project
        var buildDetails = buildServer.QueryBuilds(teamProjects[0].Name);

        // For each build
        foreach (IBuildDetail buildDetail in buildDetails)
        {
            // Get the build details
            var buildInfor = buildDetail.Information;

            // More build infor like shelveset, etc
            Debug.Write(buildDetail.LabelName + buildDetail.ShelvesetName);

        }

上面的代码将帮助您以编程方式获取构建详细信息。我有一些关于如何以编程方式连接到 tfs 并使用 tfs api 的博客文章。 http://geekswithblogs.net/TarunArora/archive/2011/06/18/tfs-2010-sdk-connecting-to-tfs-2010-programmaticallyndashpart-1.aspx

You can use the TFS API to get this done.

        public static void GetBuild()
    {
        var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfsdevlonuk:8080/tfs/gazprom.mt"), new UICredentialsProvider());
        tfs.EnsureAuthenticated();
        var buildServer = tfs.GetService<IBuildServer>();

        // Get Project Name
        var versionControl = tfs.GetService<VersionControlServer>();
        var teamProjects = versionControl.GetAllTeamProjects(true);

        // Get Builds for a team project
        var buildDetails = buildServer.QueryBuilds(teamProjects[0].Name);

        // For each build
        foreach (IBuildDetail buildDetail in buildDetails)
        {
            // Get the build details
            var buildInfor = buildDetail.Information;

            // More build infor like shelveset, etc
            Debug.Write(buildDetail.LabelName + buildDetail.ShelvesetName);

        }

The above code will help you get the build details programatically. I have some blog posts on how to connect to tfs programmatically and use the tfs api. http://geekswithblogs.net/TarunArora/archive/2011/06/18/tfs-2010-sdk-connecting-to-tfs-2010-programmaticallyndashpart-1.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文