I understand completely that Octopus can be a bit daunting at first. I would highly recommend taking a step back to get a simple Deployment working. We have a “Hello World” series available here:
This will give you the building blocks and understanding of a lot of the terms and theory around how to deploy, using Roles, Projects and Environments. This will save you time in the future, when you start working on more advanced deployments. You can also find some good information on other concepts within the documentation, especially if video tutorials are not for you. Here’s a page on the concept of Roles: https://octopus.com/docs/getting-started/octopus-concepts/target-roles
You have indeed pointed out a flaw in the “Upload FTP Files” step template. The fact that the step template cannot deploy a package without it being deployed to a target first is not ideal. The Step template was created before the introduction of the worker concept, which is why it is the way that it is, so it could use an update. We usually leave it up to the community to improve the community step templates. If you want to make changes to the step template, feel free to submit a pull request with the updated code.
If you chose to use this community step, you would need to deploy to a target first. In order to do that, you would need to create a deployment target first.
Pre Step 1: Create a Deployment Target: https://octopus.com/docs/infrastructure/deployment-targets
Step 1: Deploy a Package:
Step 2: Upload Files by FTP
Within the Upload Files by FTP step - you would reference the package from step 1. If you are unsure on how to do this, please check the link at the bottom of this reply (referencing packages).
If we were to ignore the community step, you could use powershell (or whatever language you are familiar with that is supported by Octopus) and deploy via a worker, by running this script:
# create the FtpWebRequest and configure it
$ftp = [System.Net.FtpWebRequest]::Create("ftp://ftphost")
$ftp = [System.Net.FtpWebRequest]$ftp
$ftp.Method = [System.Net.WebRequestMethods+Ftp]::UploadFile
$ftp.Credentials = new-object System.Net.NetworkCredential("anonymous","anonymous@localhost")
$ftp.UseBinary = $true
$ftp.UsePassive = $true
# read in the file to upload as a byte array
$Package = $OctopusParameters["Octopus.Action.Package[NugetTesting.Package].PackageFilePath"]
$content = [System.IO.File]::ReadAllBytes("$Package")
$ftp.ContentLength = $content.Length
# get the request stream, and write the bytes into it
$rs = $ftp.GetRequestStream()
$rs.Write($content, 0, $content.Length)
# be sure to clean up after ourselves
So to be clear - you would only need one step, which would be a “Deploy a Script”.
You would also need to reference the package within the same script step:
If you are unsure of how I determined the package variable to use in the Powershell script, please refer to this guide: https://octopus.com/docs/deployment-examples/custom-scripts/run-a-script-step#referencing-packages.
This is probably as close to a working example as I can provide for you, without knowing the ftp service you are using and it’s capabilities.
Hopefully this helps!