Skip to main content

Deploying to FTP with Octopus Deploy

 Recently I had overhauled build and deployment procedure for one of my pet projects. Project is a web app built with ASP.NET MVC and Web API, and it's hosted on one of the shared hosting platforms. Those unfortunate enough to still use shared hosting know, that there's little alternative to deploy there besides using FTP file-share.

New delivery pipeline employs Azure Pipelines as CI and Octopus Deploy for managing environments and releases as well as running deployments. Setting up a pipeline that builds web app and then pushes packages into Octopus was quite easy - I just needed to install Octopus Deploy extension into my Azure DevOps org and add correct steps into project's azure-pipelines.yml file.

Hard things to do came about when I was trying to figure out how to deploy my new shiny packages to an FTP folder provided by shared hosting. Since Octopus doesn't have dedicated FTP deployment target, I needed to find a work-around. One (and I think the only) possible way was to deploy a package on a jump-box machine and then use community "Upload files by FTP" step - much like it's described in this forum thread. Sounds doable - doesn't it? However, after initial step setup and a test run, I've got an error message that "SSH host key fingerprint "" does not match pattern" and an awfully long regular expression in it. My initial thought was "why this thing needs a host key fingerprint?" - because the FTP I was deploying to isn't secure one, I believed that all I need to provide as step parameters are host, folder name, user name and password. Trying different combinations of step parameters didn't help, so I started to look for a documentation for a step. All I found was this page on Octopus's website.

That page didn't have an explanation for my error, but it did have an entire PowerShell script for a step (you just need to click on big "Show script" button at the bottom of the page). Script itself isn't very big, so after some tinkering I was able to create my reduced version of a script, that only works with non-secure FTP servers - not that I needed more from it.

Anyway - instead of "Upload files by FTP" step, I've added a custom script as a new step into my Octopus deployment process and copied my version of a script into it. Long story short - this helped and now I'm officially deploying to FTP with Octopus Deploy!

Below is my version of an FTP uploading script.

Comments

Post a Comment

Popular posts from this blog