microsoft / azure-pipelines-tasks

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

cURLUploader fails when there are many files. #995

Closed januskh closed 8 years ago

januskh commented 8 years ago

[error]The filename or extension is too long

This error is thrown when the cURLUploader is about to upload a total of 1400 files. I have attached the log from TSVS to this issue. I hope that it makes sence. :) cUrlLog.txt

yacaovsnc commented 8 years ago

@januskh from the first glance it appears we may have reached some kind of max length somewhere. Are you currently blocked by this? If you split the cURL task into multiple steps and upload a smaller subset of files in each, does that help?

januskh commented 8 years ago

@yacaovsnc Yes, I think that the {array} gets too big. Kind of blocked... I have consider doing this too, but I am afraid not to get all files uploaded. I thought of doing it by extensions on the files, but if one of our developers suddenly add some kind of new extension, I might have a problem. An idea could be to have the task doing the upload in chunks, like 100 max at the time.. but I am still a noob in ps1 and ts. ;)

yacaovsnc commented 8 years ago

@januskh Could you split it by folders? Also I would really caution against using curl this way to do releases. What if one of your developer deletes a file? Given the way curl is used to deploy, the file will be left on the ftp server.

The original intend of this task was to upload a single or a very small amount of files to a remote application server (say tomcat), and let the remote application server handles the actual deployment (for example tomcat could be configured to auto deploy all war files).

Does your hosting service offer similar functionalities? Say could we zip everything up and just upload the single zip and extract it on the other end of connection?

yacaovsnc commented 8 years ago

@januskh I am going to test against the typescript implementation against this particular problem -- we will enable running ts task implementations on windows agent soon.

I will think about how to handle those situations, maybe gave back the file input control back to the user -- maybe I can have a check box to indicate I should take the user input verbatim so the task does not expand the list. Then we can untap the full potential of curl's glob ability.

januskh commented 8 years ago

@yacaovsnc In my case, the only way of uploading files, that my hosting company is providing is by FTP. And you are definitely right about the issue, that a developer removes a file, could be left on the server, since there is not a task for deleting files prior to FTP upload. I would really like the solution to work using hosted build, so this is my problem. I have been looking a little bit into use a powerscript instead, but I will become rather complicated too, since the out-of-the-box functionality is limited. So I found this powerscript-library ( https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb ) which could solve the issue, but then I would have to make it a part of my "package"... but that would be stupid. :)

But your idea of using typescript implementations sounds very interesting. I am very much looking forward to see it's potential and what it will become. Thank you a lot for helping out. Merry Christmas to you, your family and your team at MS. :)

januskh commented 8 years ago

I have created a FTP Uploader task, submitted it to the marketplace, and is waiting to be approved for publishing it. So... I've solved it myself.

yacaovsnc commented 8 years ago

Way to go @januskh! That's great news to hear and I look forward to see your task gets approved so others can benefit too!

januskh commented 8 years ago

@yacaovsnc Check it out here: https://marketplace.visualstudio.com/items/januskamphansen.ftpupload-task

srivatsamarichi commented 8 years ago

Hi There,

I get an error while uploading the published files through cURL upload task. I need to publish it to AWS through my TFS Release Management. However, it identifies the .zip file and uploads. But when i want to publish the contents in the folder, it's not happening.

Also tried with the FTP task, it fails too. Any help would be appreciated.

Thanks, Srivatsa

davidstaheli commented 8 years ago

Hi Srivatsa, can you please provide the build log that shows the failures for cURL and FTP? That will help diagnose the problem. You can get more information in your logs by setting a variable named System.Debug to true on the Variables tab of the build definition.

srivatsamarichi commented 8 years ago

Hi David,

PFA log for FTP upload task.

5_Upload using FTP.txt

davidstaheli commented 8 years ago

Hi Srivatsa, it looks like you're using the FTP Uploader extension from the Marketplace. I'm not familiar enough to troubleshoot it, but if you are using Team Services, you can instead use the built-in FTP Upload task provided by Microsoft. If you are running on-premises TFS 2015, Microsoft's FTP Upload task will be available in the next version (2016), or I can send you instructions on how to install it manually to your instance of on-premises TFS 2015.