Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,456,314
Community Members
 
Community Events
176
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

Atlassian Community Events