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
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 for the answer, I will try following this tutorial https://stephanwagner.me/deploy-websites-with-bitbucket-pipelines-and-git-ftp
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.