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

rysnc in pipline not working

shanedara
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2024

hello i am trying to push files from bitbucket to an aws lightsail instance. I am using rsync in my pipeline file. I have set up a specific user and added the repository public ssh key to the authorized_keys file on the lightsail instance. I keep getting a permission denied fault. I think that bitbucket is not specifying the private ssh key when it tries to connect. I am not sure why. here is the line in my pipeline yaml file that does the rsync deployment. Do i need to specify the location of the private key in this line? 

- step: &deployment
name: first deployment to production
script:
- rsync -azvSOP --delete --rsync-path="sudo rsync" --no-perms --no-owner --no-group --exclude-from=./deployment-exclude-list.txt --include=./views/twig/cms/my-cart-cms-additions.html --include=./views/twig/cms/main-assets.html ./ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH

1 answer

1 vote
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2024

Hi @shanedara 

Thanks for your question!

It is a good case for the Bitbucket Pipe usage!

As an example, you could use atlassian/rsync-deploy pipe:

Deploy your code to any server over ssh using rsync. By default it will upload the whole directory to the target. Rsync is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.

By default, the RSYNC pipe will automatically use your configured SSH key and known_hosts file configured from the Bitbucket Pipelines administration pages. You can pass the SSH_KEY parameter to use an alternate SSH key as per the instructions in the docs for using multiple ssh keys

script:
  - pipe: atlassian/rsync-deploy:0.12.0
    variables:
      USER: 'ec2-user'
      SERVER: '127.0.0.1'
      REMOTE_PATH: '/var/www/build/'
      LOCAL_PATH: 'build'
      DEBUG: 'true'
      EXTRA_ARGS:
        - "--filter=P assets/css" # double quotes here are necessary
        - "--exclude=*.txt"

 

To discover more pipes, visit our Bitbucket Pipes Marketplace.

 

Best regards,
Oleksandr Kyrdan

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events