I need to download artifacts from other plans to my build plan. However, I need it to be more flexible than I can make it with the artifact download task. More specifically I need:
Can I do this from a script? The agent runs on Windows.
I'd use the web side of things /browse/PLAN-KEY-38/artifact/shared/
EDIT:
/artifact/PLAN-KEY/shared/build-38/ is working better for me.
Adding example powershell script:
function DownloadFolderContents($url, $baseFolder = "./") { if (!(Test-Path $baseFolder)) { New-Item $baseFolder -ItemType Directory > $null } $basePath = Resolve-Path $baseFolder $html = (new-object System.Net.WebClient).DownloadString($url) -split "\n" $html |% ` { if ($_ -notmatch "<td><img .* alt=`"\((dir|file)\)`".*<a href=`"((?!`").*)`">(.*)</a>") { return } $type = $Matches[1] $path = $Matches[2] $name = $Matches[3] if ($type -eq "file") { (new-object System.Net.WebClient).DownloadFile("$bambooHost$path", $(Join-Path $basePath $name)) } else { DownloadFolderContents -url "$bambooHost$path" -baseFolder $(Join-Path $baseFolder $name)} } } $bambooHost = "http://YourOwnBambooHost" $targetPlanKey = "PLAN-KEY" $targetBuildNumber = "38" $artifactName = "ArtifactName" $url = "$bambooHost/artifact/$targetPlanKey/shared/build-$targetBuildNumber/$artifactName" DownloadFolderContents($url)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.