microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.45k stars 2.6k forks source link

Add task to download file from URL #8798

Closed mikeharder closed 5 years ago

mikeharder commented 5 years ago

Please consider adding a task to download a file from a URL. I saw similar tasks like DownloadBuildArtifacts and DownloadPackage, but nothing to download a file from a URL. The best cross-platform solution I've found so far is a python script:

- task: PythonScript@0
  inputs:
    scriptSource: 'inline'
    script: from urllib.request import urlretrieve; urlretrieve('$(url)', '$(fileName)')

But I'd rather use a specific task like:

- task: DownloadFile@0
  inputs:
    source: '$(url)'
    destination: '$(fileName)'
bryanmacfarlane commented 5 years ago

Would be a great marketplace extension (and easy to implement). Want to give it a shot?

bryanmacfarlane commented 5 years ago

I can help you through it if you want to ;)

mikeharder commented 5 years ago

Thanks for the offer, but we would prefer to use the Python script unless a built-in task is available.

andreasblueher commented 5 years ago

@bryanmacfarlane I would be up to give it a try. Could you give me a head start on where to look at?

bryanmacfarlane commented 5 years ago

Here's a step by step on creating a task:

https://github.com/Microsoft/azure-pipelines-task-lib/blob/master/node/README.md

We might want to add get to stream similar to:

https://github.com/Microsoft/typed-rest-client/blob/master/lib/HttpClient.ts#L174

See here:

https://github.com/Microsoft/vsts-task-tool-lib/blob/master/tool.ts#L223

janpio commented 5 years ago

Did a "Download" Task (directly or via Marketplace) get implemented by someone? Also looking for this.

UnicornSong commented 5 years ago

@bryanmacfarlane since this is closed, is there any updates on the (potential) Download task?

brunoborges commented 4 years ago

Any update on having a Download task OOTB ?

dataslicer commented 3 years ago

I came here looking for the same thing. After some searching, I found it here:

https://marketplace.visualstudio.com/items?itemName=Fizcko.azure-devops-download-a-file

Not sure if this is the same work done here.

NemoDima commented 2 years ago

Sorry, but could someone please explain why there is an FTP-upload task and there isn't an FTP-download task? Why is this so, perhaps I am missing some reason?

SamHard commented 1 year ago

You can write a quick PowerShell task for this using the Invoke-WebRequest commandlet. Invoke-WebRequest https://example/file.txt -OutFile C:\file.txt

wilcobrouwer commented 1 year ago

DownloadFile@1 seems to work?!

NemoDima commented 1 year ago

DownloadFile@1 seems to work?!

Could you please provide the link to the Task description of DownloadFile@1? I can see just DownloadSecureFile@1 https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/download-secure-file-v1