Deployment using FTP Task
Asked by Peter Pesta:

Hi all,

Basically what I'm trying to do is a deployment project, where I need to get some artifacts from the build process to be "uploaded" to the destination host server. Since both are windows machines, what I tried is using SCP, but there's no service on the destination server, that could listen on port 22 and accept those files. So instead, I'm trying to send the files through FTP, but can't get it right.

I'm not a developer, so unfortunately I can't get relevant output of the logfile (google didn't helped me either).

Output of the logfile:

```
error	02-Apr-2019 10:09:04	Error occurred while running Task 'FTP files to mssql db server(6)' of type com.stellarity.bamboo.ftp-task:ftpUploadTask.error	02-Apr-2019 10:09:04	java.lang.IllegalStateException: basedir C:\Bamboo\xml-data\build-dir\8093697-7831556\DEV_Bamboo does not exist.error	02-Apr-2019 10:09:04		at org.apache.tools.ant.DirectoryScanner.scan(DirectoryScanner.java:879)error	02-Apr-2019 10:09:04		at com.stellarity.ftp.Engine.findLocalFiles(Engine.java:275)error	02-Apr-2019 10:09:04		at com.stellarity.ftp.Engine.uploadFiles(Engine.java:85)error	02-Apr-2019 10:09:04		at com.stellarity.bamboo.task.FtpTask.execute(FtpTask.java:82)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:284)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:223)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:284)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:111)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:69)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:185)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:122)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:115)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:115)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:47)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)error	02-Apr-2019 10:09:04		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)error	02-Apr-2019 10:09:04		at java.lang.Thread.run(Unknown Source)simple	02-Apr-2019 10:09:04	Finalising the build...simple	02-Apr-2019 10:09:04	Stopping timer.
```

If anyone can help me out, It would be a huge help for me.

Kind Regards.


Answers:
author: Sergey Podobry _Stellarity Software_
body: Hi Peter,

The key point is this line:

```
java.lang.IllegalStateException: basedir C:\Bamboo\xml-data\build-dir\8093697-7831556\DEV_Bamboo does not exist
```

The FTP Task couldn't find a directory DEV_Bamboo.

Please provide more details about your deployment project so I can help you to configure it. If you'd like you can use another communication channel to keep details private.

comments: author: Peter Pesta
body: Hi Sergey,

Thank you very much. I've entered "DEV_Bamboo" as the destination where the artifacts should be "uploaded" to. This is the reason then why it keeps failing and can't process the task.

Gone through the documentation and figured how to enter the destination of the files, but the connection can't be established so may to look at the ports (I know that port 22 was opened for this, but since the destination host is a Windows server, may need an utility to accept the files).


author: Sergey Podobry _Stellarity Software_
body: FTP needs 2 ports: 21 for control and any other port for data. Also check windows firewall configuration.


Tags: ftp