1

I am using the Azure pipeline with Git repo for a .net application.

Is there a build step(s) that make it possible to

  1. download the zipped solution(source files) from the git repository
  2. and upload the zip file to an external API
doorman
  • 15,707
  • 22
  • 80
  • 145
  • Download the zipped solution is quite easy, you can use either [git command](https://askubuntu.com/a/939839) or [curl command](https://stackoverflow.com/a/47857787/10910450), I'm just not sure what the external API do you mean, if you just want to copy or upload the xx.zip to some place or to one machine, as I know there's available devops task can do that. But I'm not understanding your tip2 well, could you share some details about that? – LoLance Jan 30 '20 at 12:15

1 Answers1

1

I can help with the download. Haven't tried upload, but maybe you can re-use the same idea. An idea is to have a script that would call the 'curl' command to download the zip file, like in the example below, where I am creating some folder structure and then droping the downloaded file

- task: CmdLine@2
  inputs:
    script: |
      cd Folder1
      cd Folder2
      mkdir models

      curl --output models/model_name.bin https://s3.amazonaws.com/models.test/model_name.bin

And replace the URLs and destination folders and give it a try :)

Update:

I just found but did not test it. Below is the curl command for uploading:

To upload a file to an FTP server, the command would be:

curl -T FILENAME SERVER_ADDRESS -user USERNAME:PASSWORD
kgalic
  • 2,441
  • 1
  • 9
  • 21
  • Thanks @kgalic but does the script download the source files? The same way as if I would download the zip files from the Azure repository UI using the "Download as Zip" option in the action menu. – doorman Jan 29 '20 at 17:40
  • 1
    If you have the URL, it should. The script downloads anything essentially if the URL is valid. – kgalic Jan 29 '20 at 17:42
  • 1
    Just to make sure we are on the right track. For the solution that you are building the pipeline, you are actually using Azure DevOps webhook to pool the repository right? As that is the recommended way to connect the repository with the pipeline. – kgalic Jan 29 '20 at 17:45