Download Artifacts from Bamboo Ondemand

2.6k views Asked by At

I am trying to build and deploy a .NET web application using Bamboo OnDemand. 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. I also could not find a way to zip the artifacts onDemand so I could use the above command.

If anyone has overcome similar situation, then please help. Any clue/advise will be greatly appreciated. Thanks.

1

There are 1 answers

0
Avner On

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. I use 7za.exe (command line version of 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

1 - Add a Script task after the build task. I run it as a powershell inline script similar to this:

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

Modify your .csproj file, and uncomment the AfterBuild target. Use an Exec task to launch 7za, or use a custom task such as msbuild extension pack

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. That way you can version your build code.