Hi, I just set up a pipeline with rsync pipe. The code looks like this:
pipelines:
branches:
master:
- step:
script:
- pipe: atlassian/rsync-deploy:0.4.2
variables:
USER: 'myuser'
SERVER: 'www.mysite.com'
REMOTE_PATH: '/someuri/htdocs'
LOCAL_PATH: '$BITBUCKET_CLONE_DIR/htdocs/*'
EXTRA_ARGS: '-avz'
- apt-get update -y
- apt-get install -y ssh
- ssh myuser@www.mysite.com "sudo chmod -R 755 /someuri/htdocs/ && sudo chmod -R 775 /someuri/htdocs/wp-content/ && sudo chown -R myuser:group /someuri/htdocs/"
I have 2 issues here and ask for your kind advice:
1. As the USER and SERVER variables are already declared above, is there a way to use them in ssh statement below?
2. For some reason, rsync changes owner and permissions to my files in the remote host. I thought passing EXTRA_ARGS: -avz would help, but it did not. Any thoughts?
Q1 - I don't know of a way of using the variables from within the pipe, but you could define your variables before the call to the pipe and re-use them that way:
# ...
- step:
script:
- USER='myuser'
- SERVER='www.mysite.com'
- URI='/someuri/htdocs'
- pipe: Atlassian/rsync-deploy:0.4.2
variables:
USER: $USER
SERVER: $SERVER
# ...
# ...
- ssh $USER@$SERVER "sudo chmod -R 755 $URI/ && sudo chmod -R 775 $URI/wp-content/ && sudo chown -R myuser:group $URI/
Q2 - I don't know.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.