FTP deployment on bitbucket fails
Asked by Aysu Saglam:

Hi, i have dotnet project and i want to publish that project then deploy to server using ftp, but when i run the pipeline ftp step never ends and its only creates release directory on the server but nothing else, no files under that directory. Could anyone else help me?

Pipeline looks like this:

image: mcr.microsoft.com/dotnet/core/sdk:2.2  
definitions:  
steps:  
- step: \&Publish  
size: 2x  
caches:  
- dotnetcore  
script:  
- dotnet publish src/${PROJECT_NAME}/${PROJECT_NAME}.csproj -o release/ --configuration ${CONFIGURATION} /p:EnvironmentName=${ASPNETCORE_ENVIRONMENT}  
- pipe: atlassian/ftp-deploy:0.3.7  
variables:  
USER: $FTP_USERNAME  
PASSWORD: $FTP_PASSWORD  
SERVER: $FTP_IP  
REMOTE_PATH: $FTP_PATH  
LOCAL_PATH: $FTP_LOCALPATH


Answers:
author: Syahrul
body: G'day [@Aysu Saglam](/t5/user/viewprofilepage/user-id/5203189), and welcome to the community!

I suggest enabling debug options in the pipe to generate more verbose logs. This way, you can identify if there was any issue during the FTP deployment.

```
script:  - pipe: atlassian/ftp-deploy:0.4.1    variables:      USER: '<string>'      PASSWORD: '<string>'      SERVER: '<string>'      REMOTE_PATH: '<string>'      LOCAL_PATH: '<string>'      DEBUG: 'true' # Optional
```

Owh and upgrade the pipe version to use version 0.4.1 to ensure you are using an updated version.

Also, make sure the local path is correct by running a ls -lah {path} command to make sure it exists. Essentially the default local path is {BITBUCKET_CLONE_DIR}.

Cheers,  
Syahrul

comments: author: Aysu Saglam
body: Hi, thanks for your response.

My local path is : ${BITBUCKET_CLONE_DIR}/,i enabled debug mode and upgraded my ftp version. Here is pipeline logs:

+ LFTP_DEBUG_ARGS=-vvv  
+ run_pipe  
+ info 'Starting FTP deployment to $FTP_IP:/test/...'  
+ echo -e '\\e\[36mINFO: Starting FTP deployment to $FTP_IP:/test/...\\e\[0m'  
+ set +e  
lftp -u $FTP_USER,$FTP_PASSWORD -e 'set ftp:ssl-allow no; mirror -vvv --transfer-all -R /opt/atlassian/pipelines/agent/build/ /test/;quit' $FTP_IP  

it stays like that and ftp stage never ends.


author: Syahrul
body: Hi [@Aysu Saglam](/t5/user/viewprofilepage/user-id/5203189)

Thanks for the update. I have raised a support ticket for you to continue the investigation. You can view your ticket [here](https://support.atlassian.com/requests/BBS-202073/), and one of our engineers should get back to you soon.

Cheers,  
Syahrul


author: Igor Stoyanov
body: [@Aysu Saglam](/t5/user/viewprofilepage/user-id/5203189) hi.   
Here you have a command that generated via pipe workflow:

```
lftp -u $FTP_USER,$FTP_PASSWORD -e 'set ftp:ssl-allow no; mirror -vvv --transfer-all -R /opt/atlassian/pipelines/agent/build/ /test/;quit' $FTP_IP
```

Try to execute this command locally first to understand if all works as expected, maybe you will understand the root cause.  
As [@Syahrul](/t5/user/viewprofilepage/user-id/744536) mentioned you could also add running a ls -lah {path} command for additional debug.

Keep in mind ftp-deploy copy files only from your repository local path.  

Regards, Igor


author: Aysu Saglam
body: Hi, the problem happened because of accessing bitbucket to remote server. We allowed multiple ports not just 21 and problem solved. Thank you guys.


Tags: bitbucket-cloud

cloud