Cigol
Cigol

Reputation: 105

LFTP reverse mirror to remote server not uploading changed files

I'm trying to automate the deployment of my website to a remote server using Gitlab and it's CI/CD facilities. I'm using a static site generator called middleman that generates all the files into a build folder. This works locally, and if I were to manually upload the files it would reflect precisely what I want. The trouble is when using the following command although it generates all the files correctly;

$ lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rv build/ ./public_html  --delete-first --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"

This is what ends up being spat out;

Removing old file `stylesheets/styles-bb5541bd.css'
Removing old file `stylesheets/styles-bb5541bd.css.gz'
Transferring file `stylesheets/styles-4deda93b.css'
Transferring file `stylesheets/styles-4deda93b.css.gz'

I'm using asset hashes as you can see, but here it's updating the stylesheet hash, but not reflecting it in the individual HTML files that would obviously refer to the new hash... what gives? The files themselves were updated but they aren't being uploaded.

Any help on this is greatly appreciated.

Upvotes: 1

Views: 1675

Answers (1)

Paul
Paul

Reputation: 288

It's probably too late for you, but the issue is "--ignore-time". If the file size remains the same it won't be re-uploaded. So a change from 'stylesheets/styles-bb5541bd.css' to 'stylesheets/styles-4deda93b.css' in your html file won't change the size hence it won't be mirrored.

Update: Because of these issues with direct LFTP usage I now use git-ftp.

Here's my .gitlab-ci.yml

https://gist.github.com/westhouseit/5310a21ca6e6218ebc20ba94530bb0a6

and .git-ftp-ignore

https://gist.github.com/westhouseit/d3e84f3c26d733b286c0481f957052ef

Upvotes: 6

Related Questions