TFS 2015 Build vNext: cURL-FTP-Upload buggy or difficult to use

By : Mike

In my vNext-build-definition I added a new build step: "cURL Upload Files".
After a little while playing around with the syntax of the URL and optional arguments I finally accomplished it to reach my sftp-server in the right target folder - the connection works so far.
But when cURL tries to start the upload the log simply says:

curl: Can't open 'my-Subfolder/Another Subfolder/myfile.txt'!
curl: try 'curl --help' or 'curl --manual' for more information
Unexpected exitcode 26 returned by tool curl.exe

With "buggy" I mean the way of selecting files in the definition of the build step without any assistance for the user:
Try 1:
I can easily select files over the "..."-button - I can browse the folder-structure of my repository and select a file. Feels very normal. The folder is then written into the textbox "Files" - but without double-quotes although it contains spaces... This runs into an error because cURL does expectedly not understand the folder Name.
Try 2:
Then I added the double-quotes by myself, but still I get the error above.
Try 3:
Then I tried the syntax **/myfile.txt
Ahaa, this actually works!!... but this uploads all files in all folders that are named myfile.txt (the log tells me something interesting: curl is called by using another syntax with curly brackets: {"complete-path/to/my/filename"})

just in case somebody of the tfs-dev-team reads this: Another senseless link is "More Information" at the bottom of the step definition. It leads to a topic "Deploy: Azure PowerShell" - that has nothing to do with FTP-Uploads and it´s content is just "This topic hasn't been written yet.." :-(

So, I ended up now with the following possibilities:
1. Use the syntax **/filename (if you can live with the drawback that all files in all subfolders of the repo with the same filename will be uploaded, so better keep your filenames unique!)
2. Use another build step before and copy or move the file into the root folder of the repo, in order to use the file name only in the "Files"-TextBox without path information.
3. Forget cURL-build-steps: Use WinSCP with a temporary script and run it with a batch-script-step( :-)

(The above mentioned syntax with curly brackets is useless for me because it forces me to have the whole path on the build agent included, I cannot use a relative path within my repo.)

Any better ideas?

By : Mike

I could reproduce your scenario on my side with TFS 2015 update1 + curl 7.47.0:

  1. If the folder contains spaces, like Another Subfolder in your scenario, curl can't recognize it, we'll get error: curl: Can't open 'C:/agent/_work/xx/s/Another'!

  2. If we use syntax **/myfile.txt, we'll get all files in workspace that are named myfile.txt.

But if we put the files under the folder whose name doesn't contain spaces, we won't get the error curl: Can't open 'C:/agent/_work/xx/s/Another'!, so you may consider create a new folder like AnotherSubfolder and put the files need to be copied under this folder, then you can use the whole path.

This video can help you solving your question :)
By: admin