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

Escape quote in extra args

Deleted user June 12, 2019

Hi folks,

I'm trying to use the parameter --rsync-path='sudo rsync' in the EXTRA_ARGS field. But I get caught with strange escapings. I tried escaping the single quote with '' (two single quotes). I tried double quotes within the single quoted string. Nothing works. What's wrong?

e.g.

 - pipe: atlassian/rsync-deploy:0.2.0
variables:
USER: 'bitbucket'
SERVER: 'fe01.mydomain.de'
REMOTE_PATH: '/var/www/public/sandbox'
LOCAL_PATH: '.'
DEBUG: 'true'
EXTRA_ARGS: '-rzhv --delete --stats --rsync-path="sudo rsync" --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php --exclude=*.dist --exclude=/.git/ --exclude=/.bitbucket/'

 Ends in

+ run rsync -rp --delete-after -rzhv --delete --stats '--rsync-path="sudo' 'rsync"' --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php '--exclude=*.dist' --exclude=/.git/ --exclude=/.bitbucket/ . xxx@xxxx.de:/var/www/public/sandboxINFO: Starting RSYNC deployment to xxx.de:/var/www/public/sandbox...+ echo rsync -rp --delete-after -rzhv --delete --stats '--rsync-path="sudo' 'rsync"' --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php '--exclude=*.dist' --exclude=/.git/ --exclude=/.bitbucket/ . xxx@fxxx.de:/var/www/public/sandbox+ set +ersync -rp --delete-after -rzhv --delete --stats --rsync-path="sudo rsync" --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php --exclude=*.dist --exclude=/.git/ --exclude=/.bitbucket/ . xxxx@xxxx.de:/var/www/public/sandbox++ rsync -rp --delete-after -rzhv --delete --stats '--rsync-path="sudo' 'rsync"' --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php '--exclude=*.dist' --exclude=/.git/ --exclude=/.bitbucket/ . xxx@xxxx.de:/var/www/public/sandbox+ output='Warning: Permanently added the RSA host key for IP address '\''xx.99.xxx.89'\'' to the list of known hosts.bash: -c: line 0: unexpected EOF while looking for matching `"'\''bash: -c: line 1: syntax error: unexpected end of file

 

2 answers

1 accepted

0 votes
Answer accepted
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 12, 2019

Hi @[deleted] . The problem is that pipe treats the command as a list of separate tokens, so 

'--rsync-path="sudo' 'rsync"'

becomes two separate strings. We'll try to figure out how to avoid this problem.

Deleted user June 12, 2019

That would be great. I'll try the vanilla rsync command, meanwhile.

4 votes
Roman Szymański March 27, 2020

@Alexander Zhukov Did you figure it out? This is not answered

 

Stephan Hohn January 26, 2021

@Alexander Zhukov  we are facing the same issue. Any updates on this issue?

Stephan Hohn January 27, 2021
image: atlassian/default-image:latest
pipelines
:  
default:      
step:          
name'Deployment to dev'          
deploymentdevelopment          
script:            
rsync -rp --verbose --delete-after --rsync-path='sudo rsync' $BITBUCKET_CLONE_DIR/ ${USER}@${REMOTE_SERVER}:${REMOTE_PATH}

 @Roman Szymański that's working for me.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events