6

I am new to BitBucket pipelines, as I used Webhook for deploying my changes to FTP.

I have set reccommended atlassian/ftp-deploy:0.2.0 pipeline and it works fine, BUT I would like to set that ONLY CHANGED files are taken and sent to FTP.

image: node:10.15.3

pipelines:
  default:
    - step:
        name: FTP Deploy
        script: # Modify the commands below to build your repository.
          - pipe: atlassian/ftp-deploy:0.2.0
            variables:
              USER: 'myFTPusername'
              PASSWORD: 'myFTPpass'
              SERVER: 'myFTPserver'
              REMOTE_PATH: 'myFTPpath'
    - step:
        name: Deploy message
        deployment: test
        script:
          - echo "Deploying to main environment"

Any help how to set this up so it sends only changed files to FTP?

Expected output is code for bitbucket-pipelines.yml

snorbik
  • 107
  • 1
  • 9

1 Answers1

1

atlassian/ftp-deploy:0.3.6 delete all files, I found this image wagnerstephan/bitbucket-git-ftp:latest it's very useful, light and runs well and updates only changed files.

The first pipeline will run with an error, so select the commit then run again the pipeline with the init option selected.

image: wagnerstephan/bitbucket-git-ftp:latest

pipelines:
  custom:
    init:
    - step:
        script:
          - git reset --hard
          - git ftp init -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST/
    deploy:
    - step:
        script:
          - git reset --hard
          - git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST/--all
  branches:
    develop:
      - step:
          name: Deploy Develop
          deployment: develop
          script:
           - git reset --hard
           - git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST/
    master:
    - step:
        name: Deploy production
        deployment: production
        script:
          - git reset --hard
          - git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST/

NOTE: check the name of the environments in the Bitbucket repository.

e-israel
  • 623
  • 10
  • 30