Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,493
Community Members
 
Community Events
165
Community Groups

Simple SFTP Deployment

Trying to execute a simple FTP deploy from bitbucket repo to FTP host

Pipelines YML at "https://bitbucket.org/echango/modx_pb_pdf_upload/deployments" keeps displaying error on lines by columns such as; "Expected a section but found sequence" or "Unexpected property 'deployment'" or "Unexpected property 'script'"

Kept on trying to execute code samples for FTP or SFTP deployments no luck using image provided by BITBUCKET

Even searched for thsi Post https://bitbucket.org/ian_buchanan/ftp-example/src/master/ which seems to be outdated but always appears on search results:
https://confluence.atlassian.com/search/?queryString=FTP%20with%20bitbucket

1 answer

1 vote
Patrik S Atlassian Team Jun 14, 2022

Hello @Edison Chango ,

Thank you for reaching out to Atlassian Community! 

The errors you reported are usually because of formatting issues in your YML file. You can use the below link to validate the YMLconfiguration for any error in the formatting before actually committing the bitbucket-pipelines.yml file in your repository : 

As for the SFTP deploy, I would suggest using the atlassian/sftp-deploy pipe, as it has most of the underlying code already done for you, and you just need to provide some variables. Please find below an example of using that pipe :

pipelines:
default:
- step:
name: 'Deploy with SFTP'
script:
- echo "This step will use atlassian/sftp-deploy pipe"
-
pipe: atlassian/sftp-deploy:0.5.11
   variables:
     USER: '<string>'
     SERVER: '<string>'
     REMOTE_PATH: '<string>'
     LOCAL_PATH: '<string>' #Optional

For more details about the atlassian/sftp-deploy pipe and how to configure the variables, please refer to the following documentation : 

Hope that helps! Let me know in case you have any questions or run into any issues.

Thank you @Edison Chango .

Kind regards,

Patrik S

This seems to be working.  Just one more detail.  Not sure f this is about the YM, but after all deployments were performed, there seems to be a lack of privileges or command to be run for getting files deleted.  Even simple txt files, after they are deleted from Source tree, removed from bitbucket, they do not get deleted from server.

 

This YML should be showcased, how can i promote this code, it comes very handy and should be accessible to anybody deploying small stuff?  Just need to get the successful deletion issue.

 

Any advise will be greatly appreciated.

Ed

Patrik S Atlassian Team Jun 20, 2022

Hello @Edison Chango ,

If I understand you correctly, you would like the files deleted from the source to also be deleted from the destination (your FTP server).

If that is the case, I'm afraid that SFTP does not support it, as it only allows you to transfer the files from one side to another, and not actually synch the folders.

In order to actually synch the files, and delete from the destination folder all the extraneous files that are not in the source folder, I would suggest using the atlassian/rsync-deploy pipe with the DELETE_FLAG : 

- pipe: atlassian/rsync-deploy:0.7.1
  variables:
    USER: '<string>'
    SERVER: '<string>'
    REMOTE_PATH: '<string>'
    LOCAL_PATH: '<string>'
DELETE_FLAG: 'true'

This will delete all the files from the destination folder that are not in the source folder.

More details about the available variables for that pipe can be found in its official documentation : 

 

Thank you, @Edison Chango !

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,169 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you