GitLab CI: Upload files with FTP
Your deployment environment may be a bit old school and you don’t need or can’t use Docker or Kubernetes. That is fine. In this tutorial, I will show you how to upload files to an FTP server from your GitLab CI pipeline.
There is a thing about automation you should know…
GitLab CI is an amazing tool that lets us automate your scripts. However, we must not forget the meaning of the word “automation”. We want to automate something that already works, some manual task.
We can’t jump into automation if we don’t know what we want to automate. So it makes sense to first run the commands we want to automate locally, on your computer, before we jump into GitLab CI.
Manual FTP connection
The first step is to test the credentials that we have. If the CLI is not your friend yet, you can use a tool like FileZilla. It is a free & open-source project.
Make sure to follow the instructions given by your FTP server provider and configure your connection as instructed.
If this step fails, it makes little sense to continue with the rest.
Using FTP-SSL (FTP Secure)
While the title of the tutorial contains FTP, we don’t actually want to use FTP as it is insecure…