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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to get rid of the --delete-after flag rsync-deploy:0.2.0 Edited

I wan to use the rsync pipe in bb pipelines. just updating existing files, ignoring .env files and some folders.


- pipe: atlassian/rsync-deploy:0.2.0
variables: USER: $USER
EXTRA_ARGS: -ravz --exclude={'.env','web/images/','web/cpresources/'}
DEBUG: 'true'

2 answers

1 vote

Hi @Alex_Jenter ,
In a new version of rsync-deploy: 0.4.0 pipe we added DELETE_FLAG variable to make --delete-after optional. To disable --delete-after flag you may write:

  - pipe: atlassian/rsync-deploy:0.4.0
      USER: 'ec2-user'
      SERVER: ''
      REMOTE_PATH: '/var/www/build/'
      LOCAL_PATH: 'build'
      DELETE_FLAG: 'false'

Please notice that the default value of DELETE_FLAG is true - to leave the previous logic for those who already use the pipe.

If you have any questions or suggestions - feel free to leave it, we always grateful for the feedback.

0 votes

Hi @Alex_Jenter ! Currently the pipe is designed to use the --delete-after by default. To avoid deleting files you can add --max-delete=0 to extra args so no files are deleted. Please refer to the rsync man page for the more detailed description of this option. In the mean time will consider if the --delete-after should be optional. 

Hi @Alexander Zhukov thanks for the reply! Yeah `--max-delete=0`, should have seen that one in the docs, was not obvoius to me. Thx anyway!

was kinda surprised that `--max-delete=0` raised a warning at the end of the pipeline. I think it would be really awesome if there was a way to copy and preserve folders selectively without having to let the pipeline fail

@Alex_Jenter if I understand your problem correctly, you should be able to use the combination of --exclude/--include options to do what you need. For example: 

EXTRA_ARGS: --exclude='*' --include='some-dir' --include='some-other-dir'

Basically, you exclude everything first and then include needed directories explicitly. Hope this is what you need. 

Yes, that is how  i would achieve the functionality on the rsync side. The issue is that if one uses the `--max-delete=0`  option, rsync will exit with an error code of 25, hence rendering the deployment as failed.

from the rsync man page:

If that limit is exceeded, a warning is output and rsync exits with an error code of 25 (new for 3.0.0).

Would be nice if one could achieve such behaviour without raising errors.

+1 for optional `--delete-after` flag

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

3,808 views 64 20
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