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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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

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
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,217 views 0 3
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