git-ftp icon indicating copy to clipboard operation
git-ftp copied to clipboard

git-ftp is ignoring artifacts from Bitbucket pipelines build

Open Artimal opened this issue 8 years ago • 4 comments

Hi, I am doing Bitbucket pipelines build with following settings: pipelines:

  default:
    - step:
        name: Build and test JS.
        image: node:8.9.3
        script:
          - npm install
          - npm test
          - npm run-script build
    - step:
        name: Build and test PHP.
        image: php:7-fpm
        script:
          - echo "Here will be the Composer build and PHPUnit tests."          
  branches:
    production:
    - step:
        name: Build and test JS.
        image: node:8.9.3
        script:
          - npm install
          - npm test
          - npm run-script build
          - ls
          - ls public_html
        artifacts:
          - public_html/**
    - step:
        name: Build and test PHP.
        image: php:7-fpm
        script:
          - echo "Here will be the Composer build and PHPUnit tests."  
          - ls
          - ls public_html
        artifacts:
          - public_html/**
    - step:
        name: Deploy to FTP.
        image: samueldebruyn/debian-git
        script:
          - apt-get update
          - apt-get -qq install git-ftp
          - ls
          - ls public_html
          - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://$FTP_HOST

ls public_html shows me js, css files and index.html after webpack build, but that files are ignored by git-ftp even when I use .git-ftp-include.

How can I do it? Please for help.

Artimal avatar Dec 30 '17 10:12 Artimal

I am facing the same issue...

wangx6 avatar Aug 01 '18 16:08 wangx6

Have you set which git untracked assets are to be transferred using the .git-ftp-include file?

If you're also using apt-get to install git-ftp in Pipelines: I also found that the version of git-ftp that apt-get installed was an older version and required using an older syntax for the .git-ftp-include file, basically no wildcards.

mkstix6 avatar Aug 04 '18 18:08 mkstix6

As I posted in this Github thread, while git-ftp is designed to only deploy tracked file changes, it is actually possible to deploy your entire dist folder on every commit, even if these files are untracked.

You first need to create a file called .git-ftp-include in the root of your repo, and add a single line with the path to your dist folder, ensuring you add ! to the start of the line:

!.vuepress/dist/

You should (in theory) be able to then run git ftp push but for some reason this doesn't always upload the dist folder. I needed to run git ftp push --all which uploads ALL your files (even unchanged ones).

SimonEast avatar Apr 01 '19 10:04 SimonEast

The thread mentioned by Simon #46 is a good source for this problem.

I’s recommend setting up a syncroot and because the syncroot might not be tracked by git (maybe it’s in your .gitignore file) you should add it to .git-ftp-include, as Simon mentioned. to make sure it is uploaded.

So in the end you could have something like this:

content of .git-ftp-iunclude:

!dist/

Your command:

git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD --syncroot dist/ ftp://$FTP_HOST

But be aware that you will not use the advantages of git with this anymore. The complete folder is uploaded with this every time. Maybe another tool could be better in this case, for example scpor rsync.

LukasFritzeDev avatar May 16 '19 19:05 LukasFritzeDev