Forums

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

Pipelines deploy with rsync in php image

אלעד גסנר
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!
July 5, 2018

I'm trying to write the script to do continuous deployment after the testing, but rsync is not installed in pipelines containers. apt-get install rsync doesn't work either. 

How do you advise me to do continuous deployment over ssh?

 

I use the image: php:7.1.1

 

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.1

pipelines:
branches:
master:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip rsync
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- step:
name: rsync
script:
- rsync -zrSlh --stats --exclude-from=deployment-exclude-list.txt $BITBUCKET_CLONE_DIR/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH

2 answers

1 vote
Colin Shipton
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 21, 2019

In case this helps anyone, my working pipeline:

image: atlassian/default-image:latest

pipelines:
custom:
staging:
- step:
name: 'Deploy to staging'
deployment: staging
script:
- rsync -rltDvzCh --delete --stats --exclude-from=deployment/exclude -e 'ssh -e none' $BITBUCKET_CLONE_DIR/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
production:
- step:
name: 'Deploy to production'
deployment: production
script:
- rsync -rltDvzCh --delete --stats --exclude-from=deployment/exclude -e 'ssh -e none' $BITBUCKET_CLONE_DIR/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH

 I struggled with 2 issues:

  1. The -a rsync option was causing permission problems which is why I had to use -rltD instead
  2. If ssh has an EscapeChar set (which it does by default), it's not fully transparent so I had to add -e none to the ssh options
0 votes
nirpeled January 13, 2019

Hey,

Did you find a solution for this?

Thanks,

Nir

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events