port number in pipelins for deploy in FTP server in not working
Asked by Amin Atwi:

I'm using **atlassian/ftp-deploy:0.3.7** to deploy my code to a remote server.

This is my configuration into bitbucket-pipelines.yml  

definitions:  
steps:  
- step: \&staging-deployment  
name: Deploy to staging  
deployment: Staging  
image: node:14.15.0  
size: 2x  
caches:  
- node  
script:  
- pipe: atlassian/ftp-deploy:0.3.7  
variables:  
USER: $user  
PASSWORD: $STAGE_KEY  
SERVER: $serverIP  
REMOTE_PATH: /www/wwwtravizorycom_857/public/  
DEBUG: "true"  
EXTRA_ARGS: "-p 58609"  
I'm trying to add the port number in EXTRA_ARGS  
based on this documentation  
<https://manpages.ubuntu.com/manpages/trusty/en/man1/lftp.1.html>  
I can add the port number by using "-p portNumber".  
The problem is that the port number is been added at the end of the LOCAL_PATH instead of the SERVER.  
![Screenshot 2022-08-05 163346.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/209730i82124C15D1CB9D03/image-size/large?v=v2&px=999 "Screenshot 2022-08-05 163346.jpg")  
Any ideas?


Answers:
author: Ben
body: Hey Amin,

I've noticed that you have not yet received a reply from our Community so I figured I would jump in.

Have you tried to specify the port number within the server address itself in the $serverIp variable?  
For instance:  
{code}  
SERVER: 127.0.0.1:21  
{code}

I would also ensure that you make sure that at the server side, the following IP addresses are whitelisted:  
<https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/>  

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: Amin Atwi
body: Hey [@Ben](/t5/user/viewprofilepage/user-id/4537226) ,

for some reason whether adding the port number in $serverIp or not, I'm always finding ":" at the end of the $serverIp variable

for example

![Screenshot 2022-08-10 093136.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/210372iD27F7CB7CEBCBF79/image-dimensions/565x181?v=v2 "Screenshot 2022-08-10 093136.jpg")

I'm not adding ":", for some reason it keeps showing at the end of the $serverIP

any ideas why that is happening?

regards,


author: Ben
body: Hey Amin,

There's a chance that the variable has not been configured correctly or it is pulling the data from elsewhere and getting confused.

We will need to troubleshoot each element here, I'd suggest trying the following scenarios:

1. Try manually entering the SERVER field without making use of the variable and see if this makes any difference  
2. Try entering the SERVER field without variable using the hostname rather than the IP address, try this with both the port number appended to the server address and with the "-P' in the args section seperately

Cheers!

- Ben (Bitbucket Cloud Support)


author: Anthony Kolka
body: I am having this exact same issue with the same module, so it's easily reproducible. I added some exclusion args and they don't end up in the path, only the port number does.  

```
EXTRA_ARGS: '-p 455 --exclude=.gitignore --exclude=.git/ --exclude=.vscode/'
LOCAL_PATH: $BITBUCKET_CLONE_DIR
REMOTE_PATH: '/'
```


author: Amin Atwi
body: Hey [@Ben](/t5/user/viewprofilepage/user-id/4537226) ,

**finally, it worked**

I'm using **atlassian/ftp-deploy:0.3.7** to deploy into **KINSTA**

based on this documentation [SFTP with Kinsta](https://kinsta.com/knowledgebase/how-to-use-sftp/) , **KINSTA** only supports SFTP connections to ensure your data remains safe and encrypted

so I switch to **atlassian/sftp-deploy:0.5.7**after adding the proper configuration it worked.

![Screenshot 2022-08-12 115636.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/210809i248BD5FD5A6EF8D4/image-size/large?v=v2&px=999 "Screenshot 2022-08-12 115636.jpg")

My bitbucket pipeline file looks like this

image: atlassian/default-image:3  
options:  
docker: true  
size: 2x

definitions:  
services:  
docker:  
memory: 2048 #increasing docker service memory  
steps:  
- step: \&staging-deployment  
name: Deploy to staging  
deployment: Staging  
image: node:14.15.0  
size: 2x  
caches:  
- node  
script:  
- cd wp-content/themes/travizory  
- npm install  
- npm run build  
- rm -rf node_modules  
- cd ../../../  
- pipe: atlassian/sftp-deploy:0.5.7  
variables:  
USER: '${STAGE_User}'  
PASSWORD: '${STAGE_KEY}'  
SERVER: '111.111.111.111'  
REMOTE_PATH: '/www/wwwtravizorycom_857/public/'  
LOCAL_PATH: '${BITBUCKET_CLONE_DIR}'  
DEBUG: 'false'  
EXTRA_ARGS: '-P 57631'

pipelines:  
custom:

staging-deployment:  
- step: \*staging-deployment

**Regarding the PORT number,**

**![Screenshot 2022-08-12 122147.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/210811i6B0814F1A5F612F2/image-size/large?v=v2&px=999 "Screenshot 2022-08-12 122147.jpg")**

it's normal to look like this in the bitbucket pipeline.

[@Anthony Kolka](/t5/user/viewprofilepage/user-id/5006800) you need to make sure to pass the port number like that :

**EXTRA_ARGS: '-P 57631'**

[@Anthony Kolka](/t5/user/viewprofilepage/user-id/5006800) If you have any questions don't hesitate to ask me.

Regards,


author: Anthony Kolka
body: How would we also disable the hardcoded refusal to use SSL and add

```
ssl:verify-certificate no
```

instead?


author: Anthony Kolka
body: Also, how can you override the hardcoded delete first flag? Not all deployments call for wiping out what exists.


author: Anthony Kolka
body: Delete please


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

deployment