Skip to content

Instantly share code, notes, and snippets.

@junxy
Last active April 20, 2016 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junxy/d4f34e9e90f95b7ec29ace904259ee96 to your computer and use it in GitHub Desktop.
Save junxy/d4f34e9e90f95b7ec29ace904259ee96 to your computer and use it in GitHub Desktop.
https://library.octopusdeploy.com/#!/listing octopus deploy step template : Download file from url
{
"Id": "ActionTemplates-101",
"Name": "DownOutputScripts",
"Description": "Download file from url",
"ActionType": "Octopus.Script",
"Version": 4,
"Properties": {
"Octopus.Action.Package.NuGetFeedId": "feeds-builtin",
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.RunOnServer": "false",
"Octopus.Action.Script.ScriptBody": "Write-Output \"v0.1-b20160420\"\n\n#$url = \"http://devres.hjfile.cn/co/as/Output-scripts.json\"\n\n#$output = \"$($OctopusParameters['Octopus.Action[Deploy Site].Output.Package.InstallationDirectoryPath'])\\App_Data\\Output-scripts.json\"\n$output = \"$($OctopusParameters['Octopus.Action[Deploy Site].Output.Package.InstallationDirectoryPath'])\\$($output)\"\n\nWrite-Output \"Downloading.. url: $($url) => output: $($output)\"\n\n$start_time = Get-Date\n\n$wc = New-Object System.Net.WebClient\n$wc.DownloadFile($url, $output)\n#OR\n#(New-Object System.Net.WebClient).DownloadFile($url, $output)\n\nWrite-Output \"Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)\"\n\n"
},
"Parameters": [
{
"Name": "url",
"Label": "input url",
"HelpText": "download file url",
"DefaultValue": "http://devres.hjfile.cn/co/as/Output-scripts.json",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Name": "output",
"Label": "output file path",
"HelpText": "save to file path",
"DefaultValue": "App_Data\\Output-scripts.json",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"$Meta": {
"ExportedAt": "2016-04-20T03:42:50.088Z",
"OctopusVersion": "3.3.3",
"Type": "ActionTemplate"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment