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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,091
Community Members
 
Community Events
176
Community Groups

Sync with ftp-deploy

Hi guys, I need a little assistance with my pipeline for deploy on ftp server.

I tried this pipeline:

image: wagnerstephan/bitbucket-git-ftp:latest

pipelines:
default:
- step:
script:
- echo "This script runs on all branches that don't have any specific pipeline assigned in 'branches'."
branches:
master:
- step:
name: Test
deployment: production
script:
- git reset --hard
#- git ftp init -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST
- pipe: atlassian/ftp-deploy:0.3.7
variables:
USER: $FTP_USERNAME
PASSWORD: $FTP_PASSWORD
SERVER: $FTP_HOST
REMOTE_PATH: /test/my-remote-directory
EXTRA_ARGS: "--only-newer --exclude=bitbucket-pipelines.yml"
caches:
- composer

 

But for each deploy all file are overwritten. --only-newer option don't works, I think because every time git pull update the files date and overwrite existings.

Can I upload only new files (by size for example) or uplaod only changes from last commit?

I can't use rsync because my target server don't has ssh but only ftp.

Thanks & regards

2 answers

1 accepted

0 votes
Answer accepted
Syahrul Atlassian Team Jul 06, 2022

Hey @pk86 

Welcome to the community.

The option you use "--only-newer" is invalid because FTP deploys everything from the folder you've specified and does not consider what has changed. It simply overrides whatever's on the destination and pushes everything again.

As workaround, you can use Git FTP which should do what you want where it will upload the recent files change/commit only.

I hope this helps.

Cheers,
Syahrul

Thanks so much for the solution. I share my script solution if it can be helpfull for somebody else.

# Official docs git-ftp: https://github.com/git-ftp/git-ftp/blob/master/man/git-ftp.1.md
image: wagnerstephan/bitbucket-git-ftp:latest

pipelines:
custom:
init:
- step:
name: For upload all files
script:
- git reset --hard
- git ftp init -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST --remote-root $FTP_REMOTE_ROOT
catchup:
- step:
name: For set that all files on server are already updated
script:
- git reset --hard
- git ftp catchup -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST --remote-root $FTP_REMOTE_ROOT
deploy:
- step:
name: Deploy all files of current checkout
script:
- git reset --hard
- git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST --all --remote-root $FTP_REMOTE_ROOT
branches:
master:
- step:
name: Deploy production
deployment: production
script:
- git reset --hard
- git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST --remote-root $FTP_REMOTE_ROOT

 

If you need to exlude some file, you can declate them on .git-ftp-ignore

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events