设置Bamboo SVN提交构建扳机
-
30-09-2019 - |
题
Bamboo CI具有一个构建的特征,即当有人投入存储库时,颠覆程序触发了竹子的构建。我遵循有关在邮政提交挂钩中放置的内容的说明,但我不确定这两个参数应该为postcommitbuildtrigger.sh提供什么。假设项目名称是测试,并且构建名称是testbuild,服务器URL为 http:// localhost:8085. 。我在帖子提交挂钩命令行中写了这篇文章。
/<pathtopostcommit.sh> TEST TESTBUILD
问题
帖子提交.sh文件在Windows计算机上。可能是因为Windows不运行.SH文件,但是如果那样的话,有人知道如何在Windows上设置此触发器吗?
另外,我认为这会立即触发构建?是否可以触发竹子进行民意调查,以便构建会遵守安静的时期?
解决方案
必须编写自己的脚本。竹子仅分发Mac和Linux脚本。
其他提示
好的,我写了自己的。它比颠覆民意调查超时要好得多。测试:
- VisualSVN服务器2.7.2;
- Windows Web Server 2008 R2。
- Powershell 2.0
bamboowebapitrigger.bat
PowerShell的批处理文件 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
运行system.net.webclient的powershell脚本,也在 C:\SvnHooks\
. 。覆盖 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 Server Manager>“属性”>“挂钩”> Commit Hook(编辑)中的项目。
在其他任何人之后输入此行:
C:\SvnHooks\BambooWebApiTrigger.bat BambooProjectKey
bambooprojectkey是钥匙 建立计划 (不是项目)。它通常有连字符: http://bamboo.yourdomain.com:8085/browse/FOO-BAR
. 。在这种情况下,foo-bar将是关键。
配置竹子
将竹子扳机更改为 存储库触发变更时的构建
选项
您可以从VisualSVN后挂钩对话框中覆盖键,以及bamboo base URL和temp文件位置,从批处理文件跑步者中。