简体   繁体   English

从Bamboo按需下载工件

[英]Download Artifacts from Bamboo Ondemand

I am trying to build and deploy a .NET web application using Bamboo OnDemand. 我正在尝试使用Bamboo OnDemand构建和部署.NET Web应用程序。 Built successfully but I am struggling to find a way to deploy the artifacts to one of our internal server. 构建成功,但是我正在努力寻找一种方法来将工件部署到我们的内部服务器中。 And I cant open the firewall. 而且我无法打开防火墙。

I tried Bamboo CLI's getArtifact command but it could only download specified file, not the entire package. 我尝试了Bamboo CLI的getArtifact命令,但它只能下载指定的文件,而不下载整个软件包。 I also could not find a way to zip the artifacts onDemand so I could use the above command. 我也找不到一种方法来压缩工件onDemand,因此可以使用上面的命令。

If anyone has overcome similar situation, then please help. 如果有人克服了类似情况,请提供帮助。 Any clue/advise will be greatly appreciated. 任何线索/建议将不胜感激。 Thanks. 谢谢。

There are few ways to achieve this, here are a couple. 实现此目的的方法很少,这里有几个。 Both options require that you have a zip tool available on the server to do zipping. 这两个选项都要求您在服务器上具有可用的zip工具来进行压缩。 I use 7za.exe (command line version of 7zip ) 我使用7za.exe(命令行版本为7zip

This file is checked into the repository so that bamboo downloads it with your sources and your can access it from scripts or msbuild 该文件被检入存储库,以便Bamboo用您的源代码下载它,并且您可以从脚本或msbuild中访问它。

1 - Add a Script task after the build task. 1-在构建任务之后添加脚本任务。 I run it as a powershell inline script similar to this: 我将其作为类似于以下内容的powershell内联脚本运行:

Start-Process -FilePath "bamboo.build.working.directory\7za.exe" -ArgumentList "a","pathToYourArchive.zip", "folderToZip\*" -NoNewWindow -Wait 

Add a script task which zips the build output, and drops it in a location which you configure as a build artifact. 添加一个脚本任务,该任务会压缩构建输出,并将其放置在您配置为构建工件的位置。

2 - Customize your release build configuration in msbuild to do the zipping 2-在msbuild中自定义发布版本配置以进行压缩

Modify your .csproj file, and uncomment the AfterBuild target. 修改您的.csproj文件,然后取消注释AfterBuild目标。 Use an Exec task to launch 7za, or use a custom task such as msbuild extension pack 使用Exec任务启动7za,或使用自定义任务(例如msbuild扩展包)

1 is probably faster option, but as a best practice I would put any scripting into a ps1 file that is source controlled, and then modify the script to call into the ps1 file. 1可能是更快的选项,但是作为最佳实践,我会将所有脚本放入受源代码控制的ps1文件中,然后修改脚本以调用ps1文件。 That way you can version your build code. 这样,您就可以对构建代码进行版本控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM