Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Alex_Jenter May 28, 2019

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
SERVER: $SERVER
REMOTE_PATH: $REMOTE_PATH
LOCAL_PATH: $LOCAL_PATH
SSH_PORT: $SSH_PORT
EXTRA_ARGS: -ravz --exclude={'.env','web/images/','web/cpresources/'}
DEBUG: 'true'

2 answers

1 vote
Viktoriia Kozopas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 9, 2020

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:

script:
  - pipe: atlassian/rsync-deploy:0.4.0
    variables:
      USER: 'ec2-user'
      SERVER: '127.0.0.1'
      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
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2019

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. 

Alex_Jenter May 29, 2019

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!

Alex_Jenter May 29, 2019

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

Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2019

@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. 

Alex_Jenter May 31, 2019

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.

Joshua Martin December 17, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events