Teamcity API方法获取松弛通知信息

发布于 2025-02-07 02:27:59 字数 462 浏览 1 评论 0 原文

我试图通过Teamcity API列出我自己的网站中的Teamcity构建,以创建仪表板。我需要的一个功能是通知合适的人。为此,我将构建设置为“通知配置”中的构建设置。 我的问题是,有没有办法从Teamcity API中获取此信息?如果没有,是否有任何方法可以从其他地方获取此信息?

谢谢!

upd :这是放松通知器的配置方式:

在此图片上,我们选择我们选择菜单中的“松弛”选项。

在底部选项中,我们为此构建设置了Slack Channel

Im trying to list my TeamCity builds in my own site with the TeamCity API to create dashboard. One feature I need is to notify the right person. To do so I set in the build setting the right Slack channel as the notification configuration.
My question is, is there a way to get this info from the TeamCity API? And if not, is there any way to get this info from other place?

Thanks!

UPD: This is how the Slack notifier is configured:

On this picture we choose the 'Slack' option in menu.

Here in bottom option we set the slack channel for this build

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

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

发布评论

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

评论(1

娇妻 2025-02-14 02:27:59

您可以通过TeamCity REST API获得有关构建功能的信息,并且这些功能又包含有关已配置的Slack Notifier的信息。

get 请求 https://< serverUrl>/app/rest/buildTypes/id:my_build_configuration_id

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<buildType id="MY_BUILD_CONFIGURATION_ID" name="Build configuration name" projectName="project name" projectId="PROJECT_ID" href="/app/rest/buildTypes/id:MY_BUILD_CONFIGURATION_ID" webUrl="https://<serverUrl>/viewType.html?buildTypeId=MY_BUILD_CONFIGURATION_ID">
    ...
    <features count="1">
        <feature id="BUILD_EXT_63" type="notifications">
            <properties count="11">
                <property name="branchFilter" value="+:<default>
+:br_name"/>
                <property name="buildFinishedFailure" value="true"/>
                <property name="buildFinishedSuccess" value="true"/>
                <property name="firstSuccessAfterFailure" value="true"/>
                <property name="notifier" value="jbSlackNotifier"/>
                <property name="plugin:notificator:jbSlackNotifier:addBranch" value="true"/>
                <property name="plugin:notificator:jbSlackNotifier:addBuildStatus" value="true"/>
                <property name="plugin:notificator:jbSlackNotifier:channel" value="#slack-channel-name"/>
                <property name="plugin:notificator:jbSlackNotifier:connection" value="PROJECT_EXT_10"/>
                <property name="plugin:notificator:jbSlackNotifier:maximumNumberOfChanges" value="10"/>
                <property name="plugin:notificator:jbSlackNotifier:messageFormat" value="verbose"/>
            </properties>
        </feature>
    </features>
    ...
</buildType>

您对iS 插件:通知:jbslacknotifier:channel

You get get the information about Build features via TeamCity REST API and the features will in turn contain information about configured Slack notifiers.

Example of a response for a GET request to https://<serverUrl>/app/rest/buildTypes/id:MY_BUILD_CONFIGURATION_ID:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<buildType id="MY_BUILD_CONFIGURATION_ID" name="Build configuration name" projectName="project name" projectId="PROJECT_ID" href="/app/rest/buildTypes/id:MY_BUILD_CONFIGURATION_ID" webUrl="https://<serverUrl>/viewType.html?buildTypeId=MY_BUILD_CONFIGURATION_ID">
    ...
    <features count="1">
        <feature id="BUILD_EXT_63" type="notifications">
            <properties count="11">
                <property name="branchFilter" value="+:<default>
+:br_name"/>
                <property name="buildFinishedFailure" value="true"/>
                <property name="buildFinishedSuccess" value="true"/>
                <property name="firstSuccessAfterFailure" value="true"/>
                <property name="notifier" value="jbSlackNotifier"/>
                <property name="plugin:notificator:jbSlackNotifier:addBranch" value="true"/>
                <property name="plugin:notificator:jbSlackNotifier:addBuildStatus" value="true"/>
                <property name="plugin:notificator:jbSlackNotifier:channel" value="#slack-channel-name"/>
                <property name="plugin:notificator:jbSlackNotifier:connection" value="PROJECT_EXT_10"/>
                <property name="plugin:notificator:jbSlackNotifier:maximumNumberOfChanges" value="10"/>
                <property name="plugin:notificator:jbSlackNotifier:messageFormat" value="verbose"/>
            </properties>
        </feature>
    </features>
    ...
</buildType>

The property you are interested in is plugin:notificator:jbSlackNotifier:channel

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