How to upload file to an FTP Server from Azure?

Hi Shawn,

Good news! It did start uploading files :sweat_smile:
Unfortunately it did not finish and threw this error:

August 21st 2020 10:40:28

Error

OperationStopped: The running command stopped because the preference variable ā€œErrorActionPreferenceā€ or common parameter is set to Stop: Upload of C:\Octopus\Tentacle\Work\20200821003159-796-7\FtpPackage\dist\educanist\assets\scss\theme_touchspin.scss failed: WinSCP.SessionRemoteException: Error transferring file ā€˜C:\Octopus\Tentacle\Work\20200821003159-796-7\FtpPackage\dist\educanist\assets\scss\theme_touchspin.scssā€™.

August 21st 2020 10:40:28

Error

Copying files to remote side failed.

August 21st 2020 10:40:28

Error

The process cannot access the file because it is being used by another process.

August 21st 2020 10:40:28

Error

At C:\Octopus\Tentacle\Work\20200821003159-796-7\Script.ps1:323 char:5

August 21st 2020 10:40:28

Error

  • throw $_.Exception.Message

August 21st 2020 10:40:28

Error

  • 
    

August 21st 2020 10:40:28

Error

at , C:\Octopus\Tentacle\Work\20200821003159-796-7\Script.ps1: line 323

August 21st 2020 10:40:28

Error

at , C:\Octopus\Tentacle\Work\20200821003159-796-7\Bootstrap.Script.ps1: line 2163

August 21st 2020 10:40:28

Error

at , : line 1

August 21st 2020 10:40:28

Error

at , : line 1

August 21st 2020 10:40:28

Fatal

The remote script failed with exit code 1

August 21st 2020 10:40:28

Fatal

The action Upload Files By FTP From Package on a Worker failed

Darnit, so close! Iā€™m curious, if you try it again, does it fail? If it does, does it fail on the same file?

Oh! Another question, on the destination side, does the file already exist? As in, is it trying to overwrite a file on the destination?

Yes you are correct Shawn, actually because I am trying to upload an Angular web application, 90% of the files will be already deployed with some change in them. There will be only 10% new files.

Ah! Okay, Iā€™ve seen this error occur with IIS when the application is still live. Are you disabling the we application prior to deployment? If not, itā€™s possible the web server is locking the file and the upload will fail.

Actually in order to kill the app pool, Iā€™ll have to login to hosting Control panel and reset app pool from there. Which is do able but in my opinion defeats the purpose of having this automated pipeline. I know this is not a problem with Octopus but just wondering if there is a way around that using some PS script?

Maybe? Depends on how much control youā€™re allowed to have with your hosting provider. Other than that, try to do your deployments when usage would be the least? I was going to suggest maybe some retry logic, but thereā€™s really no telling when the file lock would be released.

Hi Shawn,

I was able to reset app pool manually and upload the files!! Thank you so much for your help throughout the process. I really couldnā€™t have pulled it off without your great support and special thanks for making a quick change in the template for me and uploading it :slight_smile:

Now at least I can manually deploy the site using the Octopus UI and have learned something along the way :smiley:

I have one question now that is confusing me. When we installed WinSCP module, is it installed at the machine level? If yes then does that mean that every cloud instance of Octopus is hosted on a dedicated VM? Because itā€™s possible if we are using shared machines to install or uninstall packages that are being used by other pipelines?

Secondly, whatā€™s the best way of running a step like installing this WinSCP module that essentially needs to run once per machine?

Thanks.

Absolutely, happy to help :slight_smile:

The new step template will download a temporary copy of the WinSCP PowerShell module and use it for that step only. This done on purpose as to not permanently install something that may not be wanted. The dynamic workers are part of a pool that are spun up and down so even if it was installed, thereā€™s no guarantee that it will be there. Does that make sense? I think that answers both questions?

It absolutely does :slight_smile:

Thank you once again for your help!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.