如何自定义 CruiseControl.NET (CCNet) 仪表板?

发布于 2024-09-24 20:47:42 字数 126 浏览 2 评论 0原文

我是 CCNet 新手...

我想自定义 CCNet Web 仪表板,在“强制构建”按钮旁边添加一个复选框,以指示特定构建是否要发布。

请让我知道这种定制是否可行?如果是这样,请提供一些教程或文章链接来开始

I'm new to CCNet...

I would like to customize CCNet web dashboard to add a checkbox next to "Force Build" button to indicate that particular build is for release or not.

Please let me know whether these kind of customization possible? If so, provide some tutorials or article links to start

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

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

发布评论

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

评论(1

秋心╮凉 2024-10-01 20:47:42

我认为做你想做的事情将是一个巨大的痛苦,因为你必须隐藏一些 CC.net 项目(比如说调试项目),并且如果选中该复选框,仍然构建它们。访问包含历史记录和日志的项目页面会很尴尬。如果您考虑动态编辑 ccnet 项目配置,请不要忘记您必须重新启动服务才能使其保持最新状态。最后,您的修改对于仪表板可能没问题,但会导致 cctray 出现问题。

相反,我要做的是拥有两个不同的项目,一个在调试模式下构建,一个在发布模式下构建。这会更加容易和直接。例如,您可能有一个调试项目,其构建是从源代码控制存储库更新触发的,而发布项目是手动或每晚构建的。

编辑
对于两个不同的项目,我要做的是使用公共代码(用于发布和调试)和两个动态参数(比如说 Conf 和 OutPath)组成一个块。我还将编写第三个项目来负责执行数据库脚本,该第三个项目将在发布版本的每次成功构建时触发。像这样继续将允许您单独执行调试/发布构建,单独执行脚本(在强制构建上)和在每个发布构建上,最后验证脚本(在每次提交上)。它看起来像这样:

<cb:define name="MyProject-Block">
    <project name="MyProject - $(Conf)" queue="General" queuePriority="100">
        <workingDirectory>D:\MyProject</workingDirectory>
        <triggers>
            <intervalTrigger seconds="300"/>
        </triggers>
        <cb:state-block/>
        <cb:svn-block svnpath="MyProject"/>
        <tasks>
            <msbuild>
                <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
                <workingDirectory>D:\MyProject</workingDirectory>
                <projectFile>MyProject.sln</projectFile>
                <buildArgs>/p:Configuration=$(Conf);OutputPath="$(OutPath)"</buildArgs>
                <targets>Clean;Build</targets>
                <timeout>600</timeout>
                <logger>F:\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
            </msbuild>
        </tasks>
        <publishers>
            <xmllogger/>
            <statistics />
            <modificationHistory onlyLogWhenChangesFound="true" />
            <cb:email-block/>
        </publishers>
    </project>
</cb:define>

<cb:MyProject-Block Conf="Debug" OuputPath="..\Compil\Debug" />
<cb:MyProject-Block Conf="Release" OuputPath="..\Compil\Release" />

<project name="MyProject. DbScript" queue="General" queuePriority="110">
    <workingDirectory>D:\MyProject\DB</workingDirectory>
    <triggers>
        <projectTrigger project=" MyProject - Release">
            <triggerStatus>Success</triggerStatus>
            <innerTrigger name="Eurosport.Business" type="intervalTrigger" seconds="60" buildCondition="ForceBuild" />
        </projectTrigger>
        <intervalTrigger seconds="300"/>
    </triggers>
    <cb:state-block/>
    <cb:svn-block svnpath="MyProject/DB"/>
    <tasks>
        <!-- Executing the script here -->
    </tasks>
    <publishers>
        <xmllogger/>
        <statistics />
        <modificationHistory onlyLogWhenChangesFound="true" />
        <cb:email-block/>
    </publishers>
</project>

I think doing what you wnat would be a huge pain, because you would have to hide some CC.net projects (let's say, the debug ones) and still build them if the checkbox is checked. That would be awkward to access the project's page with history and logs. If you thought about editing the ccnet project configuration on the fly don't forget you would have to restart the service to get it up-to-date. Finally your modifications could be ok for the dashboard but it will cause problem with cctray.

What I would do instead is having two distinct projects, one building in debug mode and one in release. This would be a lot more easy and straightforward. For example you could have a debug project whose builds are triggered from the source control repository updates and a release one which is manually or nightly built.

EDIT
For two different projects, what I would do is a bloc with the common code (for Release and Debug) with two dynamic parameters (let's say Conf and OutPath). I would also write a third project which takes care of executing the db script, this third project would be triggered every successful build of the Release one. Proceeding like this will allow you to execute Debug/Release builds separately, executing the script separately (on a force build) and on every Release build, and finally validating the script (on every commit). It would look like this :

<cb:define name="MyProject-Block">
    <project name="MyProject - $(Conf)" queue="General" queuePriority="100">
        <workingDirectory>D:\MyProject</workingDirectory>
        <triggers>
            <intervalTrigger seconds="300"/>
        </triggers>
        <cb:state-block/>
        <cb:svn-block svnpath="MyProject"/>
        <tasks>
            <msbuild>
                <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
                <workingDirectory>D:\MyProject</workingDirectory>
                <projectFile>MyProject.sln</projectFile>
                <buildArgs>/p:Configuration=$(Conf);OutputPath="$(OutPath)"</buildArgs>
                <targets>Clean;Build</targets>
                <timeout>600</timeout>
                <logger>F:\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
            </msbuild>
        </tasks>
        <publishers>
            <xmllogger/>
            <statistics />
            <modificationHistory onlyLogWhenChangesFound="true" />
            <cb:email-block/>
        </publishers>
    </project>
</cb:define>

<cb:MyProject-Block Conf="Debug" OuputPath="..\Compil\Debug" />
<cb:MyProject-Block Conf="Release" OuputPath="..\Compil\Release" />

<project name="MyProject. DbScript" queue="General" queuePriority="110">
    <workingDirectory>D:\MyProject\DB</workingDirectory>
    <triggers>
        <projectTrigger project=" MyProject - Release">
            <triggerStatus>Success</triggerStatus>
            <innerTrigger name="Eurosport.Business" type="intervalTrigger" seconds="60" buildCondition="ForceBuild" />
        </projectTrigger>
        <intervalTrigger seconds="300"/>
    </triggers>
    <cb:state-block/>
    <cb:svn-block svnpath="MyProject/DB"/>
    <tasks>
        <!-- Executing the script here -->
    </tasks>
    <publishers>
        <xmllogger/>
        <statistics />
        <modificationHistory onlyLogWhenChangesFound="true" />
        <cb:email-block/>
    </publishers>
</project>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文