设置 Bamboo SVN 提交构建触发器

发布于 2024-09-07 01:44:36 字数 502 浏览 0 评论 0原文

Bamboo CI 有一个内置功能,当有人提交到存储库时,颠覆程序会触发 Bamboo 中的构建。我按照在提交后挂钩中放置内容的说明进行操作,但我不确定 postcommitbuildtrigger.sh 文件的两个参数应该是什么。假设项目名称为 TEST,构建名称为 TESTBUILD,服务器 URL 为 http://localhost:8085。我在 post commit hook 命令行中写了这个。

/<pathtopostcommit.sh> TEST TESTBUILD

问题

提交后 .sh 文件位于 Windows 计算机上。这可能是因为 Windows 不运行 .sh 文件,但如果是这样,有人知道如何在 Windows 上设置此触发器吗?

另外,我认为这会立即触发构建?是否有可能触发竹子进行民意调查,以便构建将遵守安静期?

Bamboo CI has a build in feature of having the subversion program trigger a build in bamboo when someone commits to the repository. I followed the instructions of what to put in the post commit hook but I am not sure what the 2 arguments are supposed to be for the postcommitbuildtrigger.sh file. Lets say the project name is TEST and the build name is TESTBUILD and the server url is http://localhost:8085. I wrote this in the post commit hook command line.

/<pathtopostcommit.sh> TEST TESTBUILD

Question

The post commit .sh file is on a windows machine. It could be because windows doesnt run .sh files but if thats so does anyone know how to set up this trigger on windows?

Also, I think this will trigger a build immediatly? Is is possible to trigger bamboo to run a poll instead so the build will obey the quiet period?

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

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

发布评论

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

评论(2

百思不得你姐 2024-09-14 01:44:36

必须编写自己的脚本。 Bamboo 只分发 mac 和 linux 脚本。

Have to write your own scripts. Bamboo only distributes mac and linux scripts.

夜深人未静 2024-09-14 01:44:36

好吧,我自己写的。这比颠覆轮询超时要好得多。测试环境:

  • VisualSvn Server 2.7.2;
  • Windows Web 服务器 2008 R2。
  • PowerShell 2.0

BambooWebApiTrigger.bat

C:\SvnHooks\ 中 PowerShell 的批处理文件运行程序:

@echo OFF
rem this file just makes spawning powershell from VisualSvn a tad easier...
rem
rem Args from VisualSvn Server are ignored. Pass Bamboo BUILD KEY as the first
rem parameter to this script.

Powershell.exe -executionpolicy remotesigned -File C:\SvnHooks\BambooWebApiTrigger.ps1 -key %1

BambooWebApiTrigger.ps1

用于运行 System.Net.WebClient 的 PowerShell 脚本,也在 C:\SvnHooks\< /代码>。使用本地 Bamboo 服务器覆盖 bamboo.yourdefaultdomain.com

# A Powershell script to trigger Bamboo to build a specific key
param (
    [string]$baseurl = "http://bamboo.radicalsystems.com.au:8085",
    [Parameter(Mandatory=$true)]
    [string]$key,
    [string]$tmp = $null
 )

$fullUrl = $baseurl + "/updateAndBuild.action?buildKey=" + $key
if (!$tmp) {
    $tmp = [io.path]::GetTempFileName()
}

echo "Pinging Bamboo API at '$fullUrl'"
$client = new-object System.Net.WebClient
$client.DownloadFile($fullUrl, $tmp)

# comment Remove-Item to see the results.  It is a HTML result with success message.
# echo "Results are in $tmp"
Remove-Item $tmp

配置 VisualSvn

在 VisualSvn 服务器管理器中右键单击项目 >属性>挂钩>提交后挂钩(编辑)。

在任何其他行之后输入此行:

C:\SvnHooks\BambooWebApiTrigger.bat BambooProjectKey

其中 BambooProjectKey 是密钥,在浏览构建计划(而不是项目)时在您的amboo url后面找到。它通常有一个连字符:http://bamboo.yourdomain.com:8085/browse/FOO-BAR。在这种情况下,FOO-BAR 将是关键。

配置 Bamboo

将 Bamboo 触发器更改为存储库在提交更改时触发构建

选项

您可以覆盖 VisualSvn 提交后挂钩对话框中的密钥,以及批处理中的 Bamboo 基本 URL 和临时文件位置文件运行程序。

Ok I wrote my own. It's so much nicer than subversion poll time-outs. Tested on:

  • VisualSvn Server 2.7.2;
  • Windows Web Server 2008 R2.
  • PowerShell 2.0

BambooWebApiTrigger.bat

A batch file runner for PowerShell in C:\SvnHooks\:

@echo OFF
rem this file just makes spawning powershell from VisualSvn a tad easier...
rem
rem Args from VisualSvn Server are ignored. Pass Bamboo BUILD KEY as the first
rem parameter to this script.

Powershell.exe -executionpolicy remotesigned -File C:\SvnHooks\BambooWebApiTrigger.ps1 -key %1

BambooWebApiTrigger.ps1

A PowerShell script to run System.Net.WebClient, also in C:\SvnHooks\. Overwrite bamboo.yourdefaultdomain.com with your local Bamboo server:

# A Powershell script to trigger Bamboo to build a specific key
param (
    [string]$baseurl = "http://bamboo.radicalsystems.com.au:8085",
    [Parameter(Mandatory=$true)]
    [string]$key,
    [string]$tmp = $null
 )

$fullUrl = $baseurl + "/updateAndBuild.action?buildKey=" + $key
if (!$tmp) {
    $tmp = [io.path]::GetTempFileName()
}

echo "Pinging Bamboo API at '$fullUrl'"
$client = new-object System.Net.WebClient
$client.DownloadFile($fullUrl, $tmp)

# comment Remove-Item to see the results.  It is a HTML result with success message.
# echo "Results are in $tmp"
Remove-Item $tmp

Configure VisualSvn

Right click on project in VisualSvn Server Manager > Properties > Hooks > Post-commit hook (Edit).

Enter this line after any others:

C:\SvnHooks\BambooWebApiTrigger.bat BambooProjectKey

where BambooProjectKey is the key, found after your bamboo url when browsing the Build Plan (not the project). It usually has a hyphen in it: http://bamboo.yourdomain.com:8085/browse/FOO-BAR. In this case, FOO-BAR would be the key.

Configure Bamboo

Change your Bamboo trigger to Repository triggers the build when changes are committed

Options

You can overwrite the key from the VisualSvn post-commit hook dialog, as well as Bamboo base URL and temp file location from the batch file runner.

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