I’m using git-lfs and i’m wondering if there is a way to prevent the trigger of a build when the last commits only contains lfs files since there is no use to rebuild the site and I just need the files to be uploaded to the Large Media service.
All my lfs files are located in a specific “images” directory that i’m tracking, so I’ve tried the following conf in my netlify.toml:
Hi, @stephanie-w, would you please add that to your build command without the --quiet and test uploading only an image again?
So, if your build command is currently:
npm run build
Make the build command this for one image upload only:
git diff HEAD^ HEAD -- . ':!images' ; npm run build
This will show the diff command output in the deploy logs and we can see what other file is changing. I tested this in a test repo using Large Media, and I see my .gitattributes file changing when I exclude the image directory:
10:25:14 AM: Executing user command: git diff HEAD^ HEAD -- . ':!images'; echo $?;jekyll build --future
10:25:14 AM: 0
The “0” is the exit code of zero for the git diff. However, git diff only returns non-zero exit codes if the --quiet option is used (or there is actually an error). That option was not usedso the zero exit is expected.
However, there is no diff printed either, which is quite unexpected. That is something I would like to research as it should have shown what the difference was. Would you please send us a link to the deploy where this occurred?
The build is indeed canceled (see deploy 5e83add6797c060006290a4b vs 5e83ab1ad424f400060eb7ab)
But with the cancel of the build, the file pushed on the git repo in the last commit is not uploaded to the Large Media service so i guess there is no way to “bypass” the build to just upload files to the service (?).
Hi @stephanie-w, the fil is uploaded to your lfs store when you do the push on your local machine, it’s not pushed to lfs during the netlify build process so whether the build is canceled or not should not actually matter in terms of having the same in your LFS store or not.
Right, but what i need is the file to be available on the site, ie. pushed on the CDN without building the site when there is nothing to rebuild (since there is no change in the site code).
Sorry to have been unclear or ambiguous
So i’ve just focused on drastically decrease the build time so the files are on the site faster after they have been pushed on your lfs store.